# Form\_for, attributes mapping for a Search model

**URL:** <https://www.ruby-forum.com/t/form-for-attributes-mapping-for-a-search-model/150248>\
**Category:** Rails\
**Created:** [October 6, 2008, 3:56pm UTC](https://www.ruby-forum.com/t/form-for-attributes-mapping-for-a-search-model/150248 "2008-10-06T15:56:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![budu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b5e925/32.png) [@budu](https://www.ruby-forum.com/u/budu)\
**Post date:** [October 6, 2008, 3:56pm UTC](https://www.ruby-forum.com/t/form-for-attributes-mapping-for-a-search-model/150248/1 "2008-10-06T15:56:45Z")

</div>

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.
