# Advanced search form & Named scopes

**URL:** <https://www.ruby-forum.com/t/advanced-search-form-named-scopes/162964>\
**Category:** Rails\
**Created:** [March 16, 2009, 10:13am UTC](https://www.ruby-forum.com/t/advanced-search-form-named-scopes/162964 "2009-03-16T10:13:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erezbens](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@erezbens](https://www.ruby-forum.com/u/erezbens)\
**Post date:** [March 16, 2009, 10:13am UTC](https://www.ruby-forum.com/t/advanced-search-form-named-scopes/162964/1 "2009-03-16T10:13:10Z")

</div>

I have an Asset model in a Real Estate app

See the Search form & Model here:  
[http://www.qcm.co.il/qcme/index.html](http://www.qcm.co.il/qcme/index.html)

What is the best way to join all named\_scope(asset\_params) (lines  
27…34) to line 36

Thanks

Erez

---

<div class="post-metadata">

**Author:** ![erezbens](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@erezbens](https://www.ruby-forum.com/u/erezbens)\
**Post date:** [March 16, 2009, 12:24pm UTC](https://www.ruby-forum.com/t/advanced-search-form-named-scopes/162964/2 "2009-03-16T12:24:08Z")

</div>

On Mar 16, 9:12 am, “removed\_email\_address@domain.invalid” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have an Asset model in a Real Estate app
> 
> See the Search form & Model here:[http://www.qcm.co.il/qcme/index.html](http://www.qcm.co.il/qcme/index.html)
> 
> What is the best way to join all named\_scope(asset\_params) (lines  
> 27…34) to line 36

What you can do is

scope = self  
scope = scope.assettype\_filter(…) if (…)  
scope = scope.dealtype\_filter(…) if (…)  
…  
scope.paginate …

Fred
