- Get link
- X
- Other Apps
Posted by
Raj Kumar
on
- Get link
- X
- Other Apps
If you are using kaminari and will_paginate together, you will definitely face this error. In short, kaminari and will_paginate are incompatible with each other. If you are using rails_admin (which uses kaminari for pagination) and also using will_paginate, you will need to add the following code to one of the initializers under the config directory or you can create a new file, let say with the name 'will_paginate' add the code and place it into initializers directory.
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
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
That's it!! It will work like charm.
Happy Coding.
Comments
Post a Comment