Rails Will Paginate problem -
i´m paginating will_paginate
plugin.
i have popup adds @products
when user clicks button add
via ajax request.
note: @products
paginated
in ajax request update product-list :
ids = params[:accessories][:id].join(" , id <> ") @products = product.find_by_sql("select * products id <> #{ids}")
however if use: @products = product.find_by_sql("select * products id <> #{ids}").paginate
it returns identical array.
so how paginate array again?
why using find_by_sql method?
may can write this:
ids = params[:accessories][:id].join(",") @products = product.paginate(:page => params[:page], :conditions => ["not (id in (?))", ids])
also conditions can move product model , replace scope(rails 3) or named_scope(rails 2).
Comments
Post a Comment