Skip to content

Instantly share code, notes, and snippets.

@developer88
Created January 16, 2013 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save developer88/4546780 to your computer and use it in GitHub Desktop.
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 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
@lucaspiller
Copy link

Can you not also add :total_count to the list of things delegated?

@marzdrel
Copy link

Yes, you can just delegate :total_count. No need to define a method..

@snow
Copy link

snow commented Jun 6, 2015

in Rails 4 this file should be placed in config/initializers, not app/decoraters

@MaksimAbramchuk
Copy link

@snow, +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment