comfy/comfy-blog

undefined method `per' for #<Comfy::Blog::Post::ActiveRecord_AssociationRelation

Closed this issue · 4 comments

It seems like comfy_paginate is needed in the blog/posts_controller. I see that kiminary and will_paginate conflict is causing this. This has been resolved in other places, but this controller was passed over

espen commented

Yes. But this reveals another issue: comfy_paginate is defined in Comfy::Admin::Cms::BaseController and thus not available from Comfy::Blog::PostsController. I assume this should be moved to Comfy::Cms::BaseController or a new application controller which can be shared between the admin controllers and the normal site controllers. Happy to make a pull request just not sure on the implications. Any advice @GBH ?

Current workaround:

  1. copy https://github.com/comfy/comfortable-mexican-sofa/blob/b8a22f258412cef56c8c906fe6b7f2f40b9b4f43/app/controllers/comfy/admin/cms/base_controller.rb#L57-L66 to your application controller.

  2. change to @posts = comfy_paginate(scope, limit) in https://github.com/comfy/comfy-blog/blob/master/app/controllers/comfy/blog/posts_controller.rb#L33

GBH commented

I'll fix it. I wish I cold reuse one defined in CMS, but it's in a different controller scope.

GBH commented

Grab blog 1.12.3 for the fix

Thank you!