rawnet / rawnet-admin

An inheritable admin interface for Ruby on Rails apps
MIT License
0 stars 2 forks source link

undefined method `total_pages' #10

Closed boxofrad closed 9 years ago

boxofrad commented 9 years ago

A fresh app with this controller:

module RawnetAdmin
  class MonkiesController < ResourceController
  end
end

Errors with:

NoMethodError - undefined method `total_pages' for #<Class:0x007fbaa1b93648>:
  activerecord (4.2.1) lib/active_record/dynamic_matchers.rb:26:in `method_missing'
  kaminari (0.16.3) lib/kaminari/helpers/action_view_extension.rb:18:in `paginate'
  () Users/daniel/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/bundler/gems/rawnet-admin-459df3cd8990/app/views/rawnet_admin/resource/_listing_pagination.html.erb:1

Which can be fixed by adding:

include RawnetAdmin::Resource::Pagination

I think there may be an assumption the collection is paginated in a view somewhere?

:heart: :sparkling_heart:

tombeynon commented 9 years ago

yea that's my fault, extracted that functionality a little too quickly..

https://github.com/rawnet/rawnet-admin/blob/master/app/views/rawnet_admin/resource/_listing_pagination.html.erb

I'd like to keep this as a partial as it makes life easy overriding it. But without pagination being included initially, I'm not sure it should be named _listing_pagination

tombeynon commented 9 years ago

Fixed in https://github.com/rawnet/rawnet-admin/pull/11, can you take a look?