Hello,
I'm very new to rails and am trying to make a basic website where the user select from a list of colors and gets results for things with those colors from the database.
<%= form_tag("/fbcs", :method => "get") do %>
<%= check_box_tag(:qgreen) %> <%= label_tag(:qgreen, "Green") %>
<%= check_box_tag(:qred) %> <%= label_tag(:red, "Red") %>
<%= check_box_tag(:qblack) %> <%= label_tag(:black, "Black") %>
<%= check_box_tag(:qorange) %> <%= label_tag(:orange, "Orange") %>
<%= check_box_tag(:qwhite) %> <%= label_tag(:white, "White") %>
<%= check_box_tag(:qyellow) %> <%= label_tag(:yellow, "Yellow") %>
<%= check_box_tag(:qblue) %> <%= label_tag(:blue, "Blue") %>
<%= submit_tag("Search") %> <% end %>
is my form.
My database has boolean fields for these.
I have been able to get results with direct names using
@query = Fbc.where(:name => params[:qname])
but do not know how to successfully query my database with the form for checkbox fields.
Any help or guidance is appreciated, Thanks.