On 31 October 2010 12:09, MDM <[email protected]> wrote:
> Thanks for that, but I am still getting a syntax error. Now:-
> SQLite3::SQLException: near "%": syntax error: SELECT
> "homepages".* FROM       "homepages"  WHERE     (section = %'Gar'%)
>

You can't put the question mark inside the percentage signs, as Rails
SQL-escapes the variable and wraps it in appropriate delimiters...
hence your error. You need to wrap your string in percentages one way
or another and pass that in:


self.where('section = ?', "%#{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