Hi, I'm creating in my index page of my ruby on rails program, a list of the most commonly searched for terms in my database and hence each time a user selects a specific category this is written to another database.
What i would like it to create a hyperlink and pass a certain amount of parameters to a form like is usually done with a select_tag but instead with just a hyperlink, i would like to pass a set of hidden fields that i have on the page as well as what the user has selected.
To give you a better idea, basically i have the following structure in my program:
User inputs a search on (index.html.erb
), user clicks on submit tag
action, user is taken to search.html.erb
page and is displayed a set of refined categories + some fields, submit button,
user is taken to closest.html.erb
(which uses parameters from the previous form by invoking the params[:searchSelected]
and a few other params. )
I would also like to add this functionality:
Mimick this same operation, but instead of going in the search.html.erb
, i would click on an already refined search category on the index.html.erb
page (from a link_to
, transmit as parameters which link_to the user has chosen + the hidden fields.
i Currently have this code
@stats.each do
|scr|%>
<%= link_to scr.category, :action => 'closest', :id => scr.category%>
I'm not sure if this is relevant, but i currently have the following routes in my routes.rb
file
map.resources :stores, :collection => { :search => :get }
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
would anyone please assist me please? this is my first ruby on rails project and i would really like to find a way around this please