I am populating my Rails database using populator, and I have a case where I would like to build a series of records where fields start_date and end_date follow seamlessly from each other (from today back into the past).
Here is a sample of what I'm doing:
# populate.rake
Chain.populate 1 do |ch|
ch.date_end = DateTime.now
ch.date_...
Hi,
I have started with Ruby and Rails development and I am a Java developer from the last 2 years (student). I am in for two things:
Learn Ruby
Make my website on ROR
I have Agile Web Development with Rails, 2nd Edition.
So, here are my questions:
How is the Agile Web Development with Rails book to start with, where I don't know...
I need to have multiple submit buttons.
I have a form which creates an instance of Contact_Call.
One button creates it as normal.
The other button creates it but needs to have a different :attribute value from the default, and it also needs to set the attribute on a different, but related model used in the controller.
How do I do tha...
I have an option for people to store an embed link to Vimeo or YouTube as part of their profile. I'm storing it in an embed_link:string in my DB. What do I need to be careful of so people only post those links and not dangerous javascript or anything else?
...
I am implementing a simple RoR webpage that collect emails from visitors and store them as objects.
I'm using it as a mini-project to try RoR and BDD. I can think of 3 features for Cucumber:
1. User submits a valid email address
2. User submits an existing email address
3. User submits an invalid email
My question is, for scenarios 2...
Hi all,
I have a class method mixed in to all my models. the method gets called when the model class is evaluated. unfortunately (for me), this seems to be on-demand, whenever the model is needed in development env. how can have rails load all the models at start up? is this even advisable?
class Foo < ActiveRecord::Base
include Acl
...
I have 3 models
User
has_many :quetions
has_many :corrections
end
Question
has_one :correction
belongs_to :user
end
Correction
belongs_to :user
belongs_to :question
So if user Bob asks a question then user Terry can check it and if its wrong offer a correction.
Lets stay with bob and assume he as kindly corrected 5 other users, i.e...
I've started to implement a new project using Devise, which is pretty fantastic for handling users. However, when a user signs up, they're not just creating a User model, but also need to create a related Account model that represents the company. Additional users will also belongs_to this Account model.
I can't seem to find a hook for ...
I am on the ruby on rails application and trying to embed the code for js , added the whole code for embedding in Text box , But when i copy paste in other blogs where embed is poss , i am not getting the full js work , the code is given below
<%= text_field_tag "text","
script src=\"/public/javascripts/calendarview.js\">
script sr...
I'm spinning my wheels... Apache is working and serving static html, png, etc. normally. Trying to get Passenger to serve a rails app out of www.mydomain.com/rails/
as it stands when i try to hit my app: www.mydomain.com/rails/myapp/railsclassname
I get only an Apache 403 Errors. Nothing in myapp's Production Log.
Apache2 access.log: ...
I've set up my app exactly in line with the Railscasts Time Zone Episode 1 but when I run
<%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones %>
I get this error
NoMethodError in Users#new
Showing app/views/users/new.html.erb
where line #27 raised:
You have a nil object when you didn't
expect it! You ...
I have a file "Gemfile" in my Rails project root.
It says source :gemcutter in the very first line.
Do I still need the line? If I'm correct, http://rubygems.org/ is the official source, and Gem Cutter was merged into rubygems.org.
...
My path helpers (like data_path, users_path) are now translating itself to use '.' instead of '/'.
For example, data_path(@data) translates to:
data.%23<datareport:0x7fcaba0c2970>
instead of '/data/id'.
My routes look like:
map.resources :data
...
Hi,
I would like to do something like this in my application layout:
%title= "#{yield(:sub_title)} - Page Name"
and in a real view
- content_for :sub_title do
Übersicht # I tried Übersicht, != "Übersicht" and a bunch of other methods
what happens is, I either get the black pound with the question mark in it -> wrong e...
In PHP I could echo data to the web browser to debug.
eg. echo print_r($array)
How do I do that in RoR? I tried with puts with no luck.
Is there a way?
...
If using HAML on Ruby on Rails, then
:sass
#someDiv
border: 3px dashed orange
won't have any <style> tag around them.
and then
:css
:sass
#someDiv
border: 3px dashed orange
won't kick on the :sass filter, but
:css
:sass
#someDiv
border: 3px dashed orange
will kick on the :sass filter, but it is outside o...
In Ruby on Rails, routes.rb, if we create a "named route"
map.something ":a/:b", :controller => 'foobar'
it will also create something_path and something_url which are two methods usable in the controller and in the view. Does map.connect create something like that too? Otherwise, isn't map.connect somewhat disadvantaged in this way?...
I thought I read that when a Ruby on Rails server is running in production mode, it won't say so much about an error (the details, showing the code)... but I just try to run the server using
ruby script/server -e production
and add a <%= x %> with the local variable x undefined. It showed a lot of error details including the code... ...
i got this error:
SQLite3::SQLException: no such column: apis.name: SELECT * FROM examples WHERE ("apis"."name" = 'deep')
my code
Api.find :all, :from => params[:table_name], :conditions => {:name => 'deep' }
I need to make a back end rails application which will be used by a silverlight application. one of the requirements is to...
i wonder what the difference is here:
resources :photos do
member do
get :preview
end
end
# vs
resources :photos do
collection do
get :search
end
end
http://pastie.org/1001727
im not sure i dont understand it.
thanks
...