Forum: Ruby on Rails form_for, attributes mapping for a Search model...

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Nicolas B. (Guest)
on 2008-10-06 17:56
Hi, here is my problem...

I use a custom form builders for my forms, so I have to use form_for
because form_tag does not work with form builders.

I have to implement a search engine, so I created a Search model (that
does not inherit from AR:B) with virtual accessors (q, category, etc).

Then I wrote a simple form with :

form_for @search, :builder => StandardBuilder, :method => :get do |f|
...

The problem is that Rails maps all the attributes in params[:search] and
the GET URL is not pretty at all :
/search?search[q]=sometext&search[category]=3&search[...]=...

Is there a way to create a form in Rails where the model attributes are
mapped in the root of the params hash ?

Or do you have another solution for this problem ?

Thanks.
This topic is locked and can not be replied to.