Created
January 16, 2013 12:21
-
-
Save developer88/4546780 to your computer and use it in GitHub Desktop.
Fix problem with Pagination's Gem for Rails and Draper and Kaminari gem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a dirty hack to fix Draper problem with kaminari | |
# Put this in app/decorators/collection_decorator.rb | |
class Draper::CollectionDecorator | |
delegate :current_page, :total_pages, :limit_value | |
def total_count | |
source.total_count | |
end | |
end |
Yes, you can just delegate :total_count
. No need to define a method..
in Rails 4 this file should be placed in config/initializers, not app/decoraters
@snow, +1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you not also add
:total_count
to the list of things delegated?