Ruby on Rails Monday, April 30, 2012

Hello, guys.

I'm searching for days, but I'm not finding a way to do this. How can I pass like an argument by 'link_to' the selected value of a selected_tag? Like this:

<%= select_tag 'cities', options_from_collection_for_select(@cities, 'id', 'city') %>

<%= link_to "See", deals_path(:id => ??) %>

Just to clarify, all the code below is working perfectly. I just don't know what I put in '??' on the ":id => ??" to pass the selected value of the select_tag.

To make easy in your minds, remember the Groupon site. The deals page. When you choose a place, then the deals showed to you is only the deals of that place. Exactly what I want...

OBS: This is not a form. Just an index page that show a list of things of the database.

Got this, guys? Can you help me?

Hug!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/fECCwFx5SNwJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment