Forum: Ruby on Rails Best way to prune my list of returned rows?

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.
Duane (Guest)
on 2005-12-29 17:20
Every example and tutorial I can find shows how to create and paginate a
list of rows returned from a table.  But I'm trying to write an
interface on top of an existing table with 4million rows.  So I need to
jump right to the lesson on searching my data.  That, I can't find.

Can somebody tell me the techniques available for pruning down my list a
bit?  I found a "search generator", which seems like the best approach
for the long term, allowing me to search on whatever I want and doing
the grunt work of setting up the appropriate views.  But in order to
even try that out I have to run the indexer on my table, and I have no
way of predicting how many hours that will take.  I'm trying to get a
demo up and running show I can show the boss.

Second approach, I'm hoping, is to go to a field I know, like email
address (this is for user records) and break the list down into more
manageable groups by first couple of letters of email address.

Can somebody help me with that, or offer a different/better way?  I'm
playing with stuff like this:

def list
  @users = paginate User.find_by_sql "select * from users where email
like 'A%'"

but it's not really cutting it.

Francois B. (Guest)
on 2005-12-29 18:20
(Received via mailing list)
Hello Duane !

2005/12/29, Duane <removed_email_address@domain.invalid>:
> def list
>   @users = paginate User.find_by_sql "select * from users where email
> like 'A%'"
> end

Please see:


Hope that helps !
This topic is locked and can not be replied to.