I have a page which is used for searching through listings by submitting data using the supplied forms. The form parameters are submitted via ajax (post request), a new record i
If someone still has problems with pagination links, there is a fix here: Kaminari: Exclude basic form params from pagination links
Although, it does not work form me, as it was described in the commit description, there are still unwanted params in the link (:authenticity_token, :commit, :utf8, :_method), but you can exclude them by setting them to nil
For example:
paginate @books, params: {authenticity_token: nil, commit: nil, utf8: nil, action: nil}
Result:
2
OR
Controller:
def index
# here search staff, messing our params hash
@books = Books.all
@pagination_params = normalize_pagination_params
end
private
def normalize_pagination_params
params.inject({}) do |params_hash, p|
unless p[0]=="controller"
params_hash[p[0]] = nil
end
params_hash
end
end
View:
paginate @books, params: @pagination_params