Thorsten Mueller wrote: > The information is a bit vague, so I can't see the table names, > but something like: > > Model.count(:conditions => ["answer LIKE %?%", searched_word]) > > Add more conditions to select answers for squares only > > Model.count(:conditions => ["answer LIKE %?% AND type='square'", > searched_word]) > (however this type information is stored) > > Depending on the actual structure of your models/database, > additional includes may be necessary or you may have to > fall back on plain SQL. > > In any case I would try to keep it in SQL for performance reasons, > not let Ruby array functions count through lots of records.
Sorry for the vague info. I thought of this. But isn't that a burden on the server searching for each word of, let's say 30, on several thousand answer? Or does it go fast enough? -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

