2011/2/25 Vadim Antropov <[email protected]>:
> ...
> ------------------
> <%= collection_select(nil, :location_id, locations, :id, :location_name,
> {},
>                     {:prompt   => "Select an Location"},
>                     {:onchange => "#{remote_function(:url  => {:action
> => "update_cities"},
>                                                      :with =>
> "'location_id='+value")}"}) %>
>
> --------------------
>
> NoMethodError in Devise/registrations#new
>
> Showing
> C:/projects/djob/app/views/devise/registrations/_locations.html.erb
> where line #1 raised:
>
> You have a nil object when you didn't expect it!
> You might have expected an instance of Array.
> The error occurred while evaluating nil.map

Have a look at the Rails Guide on debugging.  Then set breakpoint in
the view code just before the error and inspect the data to see if it
all looks right.
First though I would check the docs for collection_select and check
that nil is valid as the first parameter.  Note particularly in
http://ap.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M000455
the second sentence and what it says about the object parameter.  I
suspect you have another problem with one of the other params that is
causing the map problem.  Perhaps one of them is nil also.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to