Forum: Ruby on Rails dynamic select menu

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Shuaib Z. (Guest)
on 2009-03-31 13:32
(Received via mailing list)
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
infinteVerve (Guest)
on 2009-04-02 19:30
(Received via mailing list)
Have any luck solving this?  I'm having the same problem.
infinteVerve (Guest)
on 2009-04-02 19:56
(Received via mailing list)
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.
Shuaib Z. (Guest)
on 2009-04-02 20:30
(Received via mailing list)
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
Shuaib Z. (Guest)
on 2009-04-02 20:43
(Received via mailing list)
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

???????????
Shuaib Z. (Guest)
on 2009-04-03 11:19
(Received via mailing list)
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
infinteVerve (Guest)
on 2009-04-09 07:42
(Received via mailing list)
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?
Shuaib Z. (Guest)
on 2009-04-09 11:21
(Received via mailing list)
Thank you very much. This way worked and saved me lots of efforts
This topic is locked and can not be replied to.