Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Ruby on Rails: collection_select

  • 23-01-2010 02:23AM
    #1
    Registered Users, Registered Users 2 Posts: 2,265 ✭✭✭


    I have the below in a view and it displays the drop-down menu correctly.
    <%= collection_select :user, :organisation_id, @all_organisations, :id, :name %>
    

    I want to determine what value is currently selected and use it in the view to create a link.
    So I think I'm looking for some way to address the selection and find it's current value.
    I've tried using its name and id (user[organisation_id], user_organisation_id) but to no avail. Rails complains about an undefined local variable or method in both cases.

    Any ideas?


Advertisement