-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wf_filter gives 'Called id for nil,' error #28
Comments
Where are you getting this error? Is it from your code or from will_filter wf_filter is not really exposed this way - it is injected into the @users = User.filter(:params => params) then you can access will filter: @users.wf_filter.id Can you show me a full example of what you do? On Thu, Jul 19, 2012 at 10:55 AM, anu-vaid <
|
Thanks for the quick response. Here's what I did
gem "will_filter"
MyApp::Application.routes.draw do
class UsersController < ApplicationController def index end
I got an undefined method 'per' error. Read some and realized kaminari is conflicting with will_paginate so added
and then I get
when I try and go to /companies/1/users Anupama Vaid On Jul 19, 2012, at 11:25 AM, Michael Berkovich wrote:
|
I'm also seeing this issue when I go to [mysite]/tr8n/admin/language. |
I've tracked the problem down to these two lines (821,822) in /app/models/will_filter/filter.rb : recs = recs.page(page).per(per_page)
recs.wf_filter = self The problem occurs when trying to replace kaminari with will_paginate, as will_paginate returns an ActiveRecord::Relation instead of an Array. recs = recs.page(page).per(per_page).to_a However, it appears that a lot more work is necessary to replace kaminari with will_paginate as #8 suggests. Nevertheless it would be nice to have the option to chose between will_paginate and kaminari soon. |
Tried to use will_filter but cannot get it to work.
Kaminari.configure do |config|
config.page_method_name = :per_page_kaminari
if defined?(WillPaginate)
module WillPaginate
module ActiveRecord
module RelationMethods
def per(value = nil) per_page(value) end
def total_count() count end
end
end
module CollectionMethods
alias_method :num_pages, :total_pages
end
end
end
end
The text was updated successfully, but these errors were encountered: