# Dynamic select menu

**URL:** <https://www.ruby-forum.com/t/dynamic-select-menu/164345>\
**Category:** Rails\
**Created:** [March 31, 2009, 11:32am UTC](https://www.ruby-forum.com/t/dynamic-select-menu/164345 "2009-03-31T11:32:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [March 31, 2009, 11:32am UTC](https://www.ruby-forum.com/t/dynamic-select-menu/164345/1 "2009-03-31T11:32:24Z")

</div>

Hi there

I have seen railscasts episode 88 about dynamic select menus and I  
implemented it. However, it has some bugs, I managed to tackle some.

But I saw a better way to do that using related select forms

[http://agilewebdevelopment.com/plugins/related\_select\_forms](http://agilewebdevelopment.com/plugins/related_select_forms)

according to the readme file this way looks very easy but when I run  
it on rails 2.2.2 i get this error

uninitialized constant  
ActionView::Helpers::RelatedSelectFormHelper::OrderedOptions

any idea how to solve it or if there is another plugin that does the  
same function

Thanks

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [April 2, 2009, 5:30pm UTC](https://www.ruby-forum.com/t/dynamic-select-menu/164345/2 "2009-04-02T17:30:23Z")

</div>

Have any luck solving this? I’m having the same problem.

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [April 2, 2009, 5:56pm UTC](https://www.ruby-forum.com/t/dynamic-select-menu/164345/3 "2009-04-02T17:56:10Z")

</div>

Line 59 in 'vendor/plugins/related\_select\_forms/lib/  
related\_select\_form\_helper.rb ’

changed this:  
result[reference\_value] ||= OrderedOptions.new

to:  
result[reference\_value] ||= ActiveSupport::OrderedOptions.new

I don’t get the error anymore, but my ‘related\_collection\_select’ box  
is coming up empty everytime.

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [April 2, 2009, 6:43pm UTC](https://www.ruby-forum.com/t/dynamic-select-menu/164345/4 "2009-04-02T18:43:42Z")

</div>

I solved this error  
\<%= related\_collection\_select(:street, :id, “city\_id”, Street.find  
(:all), :id, :name, :city\_id) %\>

make the third parameter in double quote like city\_id

however, i face the same problem, the second select menu does not  
appear

???

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [April 2, 2009, 6:30pm UTC](https://www.ruby-forum.com/t/dynamic-select-menu/164345/5 "2009-04-02T18:30:47Z")

</div>

So far no

I changed the line you mentioned

i get this error now  
wrong number of arguments (5 for 4) — the error fot  
relared\_collection\_select line

\<%= collection\_select(:city, :id, City.find(:all, :order =\>  
“name”), :id, :name) %\>  
\<%= related\_collection\_select(:street, :id, [:city, :id], Street.find  
(:all), :id, :name, :city\_id) %\>

I am I doing it the wrong way

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [April 3, 2009, 9:19am UTC](https://www.ruby-forum.com/t/dynamic-select-menu/164345/6 "2009-04-03T09:19:36Z")

</div>

Hi guys

Any one is aware of another plugin other than this one that does the  
same thing

select a country and then display its state this is what we are  
looking for

thanks

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [April 9, 2009, 9:21am UTC](https://www.ruby-forum.com/t/dynamic-select-menu/164345/7 "2009-04-09T09:21:13Z")

</div>

Thank you very much. This way worked and saved me lots of efforts

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [April 9, 2009, 5:42am UTC](https://www.ruby-forum.com/t/dynamic-select-menu/164345/8 "2009-04-09T05:42:10Z")

</div>

Try this…

I got the same error when going from Rails 2.1.1 to 2.2.2

in line 66 of 'vendor/plugins/related\_select\_forms/lib/  
related\_select\_form\_helper.rb ’

change:  
ActionView::Helpers::InstanceTag.new(object, method, self, nil,  
options.delete(:object)).

to:  
ActionView::Helpers::InstanceTag.new(object, method, self,  
options.delete(:object)).

then:  
\<%= related\_collection\_select(:street, :id, [:city, :id], Street.find  
(:all), :id, :name, :city\_id) %\>

that work?
