# How do we '

**URL:** <https://www.ruby-forum.com/t/how-do-we/118204>\
**Category:** Rails\
**Created:** [May 11, 2007, 8:24pm UTC](https://www.ruby-forum.com/t/how-do-we/118204 "2007-05-11T20:24:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bravedave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/46a35a/32.png) [@bravedave](https://www.ruby-forum.com/u/bravedave)\
**Post date:** [May 11, 2007, 8:24pm UTC](https://www.ruby-forum.com/t/how-do-we/118204/1 "2007-05-11T20:24:12Z")

</div>

Dear RubyReportist’s  
I’ve been beating up the Rails web forums for the last week trying to  
understand how ‘mature’ Rails web developers’ elect to allow their  
users to ‘mince’ the data.  
We all know that a normal INDEX action in Rails usually does a  
Table.find(:all) and there we show the user a list (page by page) of  
the ‘whole show’.  
Now, what happen’s when the user wants to just see a part of it, or  
sort by a field, or select a result set a group of separate fields?  
I’ve seen code like this:  
def self.search(town, beds, min\_price, max\_price)  
conditions = []  
conditions \<\< [‘town = ?’, town] if town  
conditions \<\< [‘beds = ?’, beds] if beds  
conditions \<\< [‘price \>= ?’, min\_price] if min\_price  
conditions \<\< [‘price \<= ?’, max\_price] if max\_price  
find(:all, :conditions =\> [conditions.transpose.first.join(’ and '),  
\*conditions.transpose.last])  
But not found anyone that can tie it all together. Are there any  
people in this group that would be willing to consult to show me a  
simple example of how this could be done?  
David K.  
removed\_email\_address@domain.invalid  
775-885-9125
