Getting syntax error in paginate function- Rhodes 4

G Girish Sunkeri 3 years 7 months ago
1 1 0

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 + "%'",
                  ],

Please Register or Login to post a reply

1 Replies

K Kutir Mobility

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

CONTACT
Can’t find what you’re looking for?