Hi,
Try this if you wish to have your code clean :
http://railscasts.com/episodes/88-dynamic-select-menus

On Jun 13, 2:03 pm, Sindri Guðmundsson <[email protected]> wrote:
> Finally got it working, used this solution;
>
> <%= select_tag "cat_selected", options_for_select(['Flokkar
> mælitækis']...@cats_for_mt),
>   :onchange => 'window.location.href = "viewflokkur_from_select/" +
> this.selectedIndex'%>
>
> That gave me params[:id] = index-selected, so I created this new method
> viewflokkur_from_select wich gets @cats_for_mt[params[:id].to_i-1] and
> then redirects to viewflokkur with that value as params[:cat]. Not very
> pretty, and a whole lot uglier than I expected, but works...
>
> Thanks everyone for the suggestions!
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to