Can someone help me please. I have a form on one page that is
functioning as a search form. After I get the results on the next page
I would like to be also able to read the search options selected which
are in the URL of the results page. What is need for me to be able to
do some conditional statements against them.
try <%= params[:id] %>
what Ajit wanted to show is that all the parameters in the url are
available in the params hash
for an url like that
http://localhost:3000/companies?test=test&province=&building_systems=1&wood_based_panels=1
you should have
params[:test] containing “test”
params[:province] is empty
params[:building_system] containing “1” (as a string!)
and so on
you van use that in your controller code like
if params[:building_system] == “1” then
… do something …
end
or in your erb code like Ajit showed.
dosen’t seem to work. this is the URL with the Paramaters that I am
wanting to grab
http://localhost:3000/companies?test=test&province=&building_systems=1&wood_based_panels=1