Forum: Ruby on Rails linking to a form submit

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
861b0f573f69e2d9e834a3e75c8df408?d=identicon&s=25 (Guest)
on 2007-06-08 02:02
(Received via mailing list)
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.

75d66d19201c2e8193de9b62145d01a0?d=identicon&s=25 Morgan Whitney (Guest)
on 2007-06-08 03:10
(Received via mailing list)
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.

<A href="#" onclick="document.myform.submit()">Submit</A>

On 6/7/07, <> wrote:
> try, I get this error:
> the link, I get that error.
> Charlie
> >

F. Morgan Whitney
This topic is locked and can not be replied to.