Couple of alternatives for you... Put it in an index ala Lucene or its
Ruby sibling Ferret. Or... if you want to keep it pure SQL then...
EZWhere.
http://ferret.davebalmain.com/trac/
http://rubyforge.org/projects/ez-where/
On 11/7/06, Michael Satterwhite
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> I have a database table with quite a few fields in it (more than I like,
> but needed to meet the specs). I''m needing to do a fairly complex
query
> that will be built on the fly according to parameters given by the user.
> find_by_name_and ... isn''t too useful as I''m not sure
which fields I''m
> finding by until the user enters their data. Also, I''d really be
> surprised if rails built in find_by could handle 20 - 25 predicates -
> which is possible.
>
> I was looking for a find method that would allow me to simply specify a
> condition string ("itemgroup > 2 and buildwidth < 200 and
"), but I
> don''t see one. I see the find_by_sql, and can certainly use it,
but with
> the linked tables (owned by) the fields and joins are going to be fun to
> build - doable, but fun.
>
> I can''t be the first to run across this need in rails. Is there
another
> way than find_by_sql - or should I start coding the raw select? Since
> I''ve been working in rails, I''ve become kinda lazy.
<g>
>
> Thanks in advance
> ---Michael
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---