Hello, i need help.
Devise + custom action in DeviseRegistrationController + dynamic select.
Manual:
http://pullmonkey.com/2008/3/30/dynamic-select-boxes-ruby-on-rails/
Error:
Hello, i need help.
Devise + custom action in DeviseRegistrationController + dynamic select.
Manual:
http://pullmonkey.com/2008/3/30/dynamic-select-boxes-ruby-on-rails/
Error:
Either that should be f.collection_select or you need an extra
parameter before :country_id
Colin
_locations.html.erb
_locations.html.erb
--------------------------
<p><%= label_tag :location %><br />
<%= collection_select (:location_id, locations, :id, :location_name,
{:prompt => "Select an Location"}, {:onchange =>
"#{remote_function(:url => {:action => "update_cities"}, :with =>
"'location_id='+value")}"}) %></p>
--------------------------_cities.html.erb
--------------------------
<p><%= label_tag :city %><br />
<%= collection_select(:city_id, cities, :id, :city_name, {:prompt =>
"Select a City"}) %></p>
--------------------------what to do with partials?
new error:
--------------------------
NoMethodError in Devise/registrations#newShowing
C:/projects/djob/app/views/devise/registrations/_locations.html.erb
where line #2 raised:undefined method `map' for
Symbol
Extracted source (around line #2):1: <p><%= label_tag :location %><br />
2: <%= collection_select (:location_id, locations, :id,
You are still using the syntax for f.collection_select, but are just
using collection_select. Check the docs for that method, you need an
extra parameter before :location_id. See
http://ap.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M000455
Colin
Colin Law wrote in post #983650:
--------------------------
NoMethodError in Devise/registrations#newShowing
C:/projects/djob/app/views/devise/registrations/_locations.html.erb
where line #2 raised:undefined method `map' for
Symbol
Extracted source (around line #2):1: <p><%= label_tag :location %><br />
2: <%= collection_select (:location_id, locations, :id,You are still using the syntax for f.collection_select, but are just
using collection_select. Check the docs for that method, you need an
extra parameter before :location_id. See
http://ap.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M000455
Colin
def update_locations
# Обновляем области и города на основе выбранной страны
country = Country.find(params[:country_id])
locations = country.locations
cities = country.cities
render :update do |page|
page.replace_html 'locations', :partial => 'locations', :object =>
locations
page.replace_html 'cities', :partial => 'cities', :object =>
cities
end
end
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