On 31 October 2010 19:36, MDM <[email protected]> wrote:
> Thanks Michael
> I have tried that along with other versions of '%search_item%'without
> self.where('section = ?', '%search_item%') does not work and you
> cannot use %without a ' or "
Oops.... just spotted....
if you're trying to do a SQL query with "%" you need to use "LIKE"
instead of "="
self.where('section LIKE ?', "%#{search_item}%")
--
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.