Dynamic select menu


#1

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

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


#2

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


#3

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.


#4

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

???


#5

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


#6

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


#7

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


#8

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?