Wow Thanks Michael
After all this time.
Both of these works which do you think is best.
     self.where('section LIKE ?', "%#{search_item}%")
     self.where('section LIKE ?', '%'+search_item+'%')
I can now get back to the remote => ajax call.
Pure joy Thanks again Don

On Oct 31, 7:40 pm, Michael Pavling <[email protected]> wrote:
> 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.

Reply via email to