-
Notifications
You must be signed in to change notification settings - Fork 235
Kaminari in Cells
Nick Sutterer edited this page May 13, 2014
·
4 revisions
A very convenient way is to use the kaminari-cells gem. It is not more than 10 lines of code and simply works.
Kaminari looks its partials in Rails view_paths, so to use it from Cells, you should do few additional steps:
- Run
rails g kaminari:views default
to generate copy of kaminari views inside your app - Generate an initializer for kaminari with
rails g kaminari:config
: - Edit this file and add this code at the beginning:
Kaminari::Helpers::Tag.class_eval do def to_s(locals = {}) #:nodoc: @template.render :partial => "../views/kaminari/#{@theme}#{self.class.name.demodulize.underscore}", :locals => @options.merge(locals) end end
After that, Kaminari calls from Cell will render app/cells/../views/kaminari/* files, so you don't need to add the entire app/views folder to Cells view paths