I am using a select menu to allow people to pick an item and be taken to
a new page containing that item’s data. Pretty straightforward stuff.
Except that I cannot quite figure out how to do this in Rails.
I do not understand how to grab the variable from the select menu. With
the code I am using, I cannot get the data into the mysql query.
Can someone point me in the right direction?
This is the code for the select menu (it uses an array of arrays in the
model file):
<%= start_form_tag :action => ‘history’ %>
<%= options = [["Select client", ""]] +
Notification::CLIENTS
select(“notification”, “client”, options) %> |
<%= submit_tag "Select" %> |
<%= end_form_tag %>
This is the code in the controller:
def history
if(params[:notification])
@client = (params[:notification])
@notifications = Notification.find(:all, :conditions => ["client =
?", @client])
end
end
Thanks!
Nathan M.
Operations Director
Northeast Region
Pilgrim IT, LLC
NORTHEAST OFFICE
1 Short Street
Northampton, MA 01060
TEL 866.434.4976
FAX 413.587.0572
MIDWEST OFFICE
1815 Brownsboro Road
Louisville, KY 40206
TEL 502.721.7939
FAX 502.721.7940
NOTICE: This email and any attachments are intended only for the
addressee and may contain information that is confidential and/or
legally privileged. If you are not the intended recipient or have
received this email in error, please notify the sender by return email
or by calling 866-434-4976. You should then delete the message and any
attachments or copies. If you are not the intended recipient, you are
prohibited from retaining, distributing, disclosing or using any
information contained herein.