Hello All,
I'm using paginate function similar to the one shown below. It works fine on Android but when I run it on IPhone simulator i'm getting
could not prepare statement : 1; Messge: near \"%\":syntax error
:per_page => pageCount,
:conditions => [
"Name like ?",
"'%" + searchName + "%'",
],
1 Replies
Hi Girish
Can your try like(I tried this both in iPhone and Android rhosimulator and its works fine for me)
User.find(:all, :conditions => [ "name like '%"+name+"%'"], :select => ['name']
Note: If your model type is fixed schema then you can try like
Post.find_by_sql("SELECT * FROM 'Post' where name like '%"+name+"%'")
Thanks
Kutir Mobility