Linking to a form submit

Hi, I have a form that looks like this, and it works fine:

  <% form_for :search_term, :url => { :action => :search} do |f|

<%= f.text_field ‘search_term’ %>
<%= submit_tag ‘Search’ %>
<% end %>

I want to make a link that submits to the same action, but I when I
try, I get this error:

undefined method `stringify_keys!’ for “test search”:String

Here is my attempted link_to:

<%= link_to(truncate(recent_search.search_term, 40), {:controller =>
‘admin’, :action => ‘search’, :search_term =>
recent_search.search_term }, :method => :post ) %>

By the way, this search string displays just fine – but when I click
the link, I get that error.


While helpers are nice, this is so simple to do with JavaScript I
can’t think of any reason not to do it. Just make sure your form tag
has name and id attributes.


On 6/7/07, [email protected] [email protected] wrote:

try, I get this error:
the link, I get that error.


F. Morgan Whitney

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs