# NoMethodError in Devise/registrations#new

**URL:** <https://discuss.rubyonrails.org/t/nomethoderror-in-devise-registrations-new/57521>\
**Category:** rubyonrails-talk\
**Created:** [February 24, 2011, 1:10pm UTC](https://discuss.rubyonrails.org/t/nomethoderror-in-devise-registrations-new/57521 "2011-02-24T13:10:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [February 24, 2011, 1:10pm UTC](https://discuss.rubyonrails.org/t/nomethoderror-in-devise-registrations-new/57521/1 "2011-02-24T13:10:08Z")

</div>

Hello, i need help. Devise + custom action in DeviseRegistrationController + dynamic select.

Manual: [http://pullmonkey.com/2008/3/30/dynamic-select-boxes-ruby-on-rails/](http://pullmonkey.com/2008/3/30/dynamic-select-boxes-ruby-on-rails/)

Error:

---

<div class="post-metadata">

**Author:** ![Colin\_Law1](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@Colin\_Law1](https://discuss.rubyonrails.org/u/Colin_Law1)\
**Post date:** [February 24, 2011, 1:31pm UTC](https://discuss.rubyonrails.org/t/nomethoderror-in-devise-registrations-new/57521/2 "2011-02-24T13:31:12Z")

</div>

Either that should be f.collection\_select or you need an extra parameter before :country\_id

Colin

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [February 24, 2011, 2:25pm UTC](https://discuss.rubyonrails.org/t/nomethoderror-in-devise-registrations-new/57521/3 "2011-02-24T14:25:23Z")

</div>

\_locations.html.erb

---

<div class="post-metadata">

**Author:** ![Colin\_Law1](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@Colin\_Law1](https://discuss.rubyonrails.org/u/Colin_Law1)\
**Post date:** [February 24, 2011, 4:03pm UTC](https://discuss.rubyonrails.org/t/nomethoderror-in-devise-registrations-new/57521/4 "2011-02-24T16:03:40Z")

</div>

> \_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#new
> 
> Showing 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](http://ap.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M000455)

Colin

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [February 25, 2011, 9:20am UTC](https://discuss.rubyonrails.org/t/nomethoderror-in-devise-registrations-new/57521/5 "2011-02-25T09:20:42Z")

</div>

Colin Law wrote in post #983650:

> > -------------------------- NoMethodError in Devise/registrations#new
> > 
> > Showing 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](http://ap.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M000455)

> Colin

def update\_locations &nbsp;&nbsp;&nbsp;&nbsp;# Обновляем области и города на основе выбранной страны &nbsp;&nbsp;&nbsp;&nbsp;country = Country.find(params[:country\_id]) &nbsp;&nbsp;&nbsp;&nbsp;locations = country.locations &nbsp;&nbsp;&nbsp;&nbsp;cities = country.cities

&nbsp;&nbsp;&nbsp;&nbsp;render :update do |page| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;page.replace\_html 'locations', :partial =\> 'locations', :object =\> locations &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;page.replace\_html 'cities', :partial =\> 'cities', :object =\> cities &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;end

---

<div class="post-metadata">

**Author:** ![Colin\_Law1](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@Colin\_Law1](https://discuss.rubyonrails.org/u/Colin_Law1)\
**Post date:** [February 25, 2011, 9:41am UTC](https://discuss.rubyonrails.org/t/nomethoderror-in-devise-registrations-new/57521/6 "2011-02-25T09:41:32Z")

</div>

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](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
