will paginate - paginate_by_sql, next page error -
i'm using will_paginate (3.0.pre2) rails 3.0.0.rc. first page pulls fine when go page 2, returns nothing because query page 2 not being set correctly will_paginate.
controller:
page = params['page'].blank? ? 1 : params['page'] @posts = post.paginate_by_sql (['select * foo_table ids = ?', params[:ids]], :page=>page, :per_page=>50) @pag_params = {:ids=>params[:ids]}
view:
<%= will_paginate @posts, :params=>@pag_params %>
link page 2 is:
http://localhost:3000/posts/search?page=2&ids=1
logs show clause show incorrect (ids = 'search') when should (ids = '1')
select * `foo_table` (ids = 'search')
what missing query page 2 can corrected?
talked developer of of will_paginate , found out best way attack using scoped_by_column_name(...column_value...).paginate(...conditions...)
hope helps someone. :)
Comments
Post a Comment