I'm doing a Rails project for class where a user can enter a search term, the results are displayed (images), then the user can click on an image to get a larger version of it.
On the larger version page, I have a button_to :back.
<%= button_to "Back", :back %>
But when I hit the button, the image results page it returns to shows the default images, not the ones returned from the search. I need to be able to pass params[:search_term] back to the previous page (as without a :search_term value, the default images are returned).
I tried this:
<%= button_to "Back", :back, :search_term => params[:search_term] %>
And when viewing the page source, it looks like it should pass the parameter back:
<form action="http://localhost:3000/albums/7/add" class="button_to" method="post">
<div>
<input search_term="puppy" type="submit" value="Back" />
<input name="authenticity_token" type="hidden" value="lkjsakvgjwhatever" />
</div></form>
The authenticity token gets returned back, but my search_term doesn't.
EDIT:
Here's the view:
<%= image_tag("http://farm#{@pic["farm"]}.staticflickr.com/#{@pic["server"]}/#{@pic["id"]}_#{@pic["secret"]}_c.jpg") %>
<br><br>
<%= @pic["title"] %>'
<br><br>
<br><br>
<%= button_to "Back", :back, {:search_term=> params[:search_term]} %>