This is what my index.html.erb looks like:

<% form_tag(:controller => 'opt', :action => 'index', :id => 1) do %>
   <%= select_tag "option", options_for_select(@options, "") %>
   <%= submit_tag "go"%>
<%end%>


In my controller, for my index method I have:

class optController < ApplicationController

def index
@options = ["Option A", "Option B", "Option C"]
end


As you can see I'm only passing the id: 1 everytime I click go. How 
would I make it so the selected choice's id is passed instead. For 
example if I choose Option B from the menu, 2 should be passed. Then I 
can access this 2 in my controller through some variable maybe?

-- 
Posted via http://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 https://groups.google.com/groups/opt_out.


Reply via email to