Would like to pass some parameters to the _path for link_to or redirect_to. For example, link_to ‘show’, customers_show_path(params[:id]) will show the customer with id=params[:id].
What do I do if I want to pass another parameter such as session[:user_id] into the show? Does link_to ‘show’, customers_show_path(params[:id], :user_id => session[:user_id]) work (retrieve session[:user_id] with params[:user_id] in show)?
Any suggestions?
Try this:
Didn’t check, but should work 😀
Following are the similar questions:
pass parameter by link_to ruby on rails
rails – Pass id parameter on a link_to
passing a parameter to the link_to method
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/57a63381c8bdc6a5?pli=1