Sha256: 80413f616bb2d71122dd2a13c473da4c8b8967d4b297f5fc3d78f0cbd7951e31
Contents?: true
Size: 866 Bytes
Versions: 3
Compression:
Stored size: 866 Bytes
Contents
#************************************************************************************* # Insert methods in the Action Controller of a Rails project. #************************************************************************************* module NeatPages::Implants::ActionControllerImplant extend ActiveSupport::Concern included do append_after_filter :set_pagination_header helper_method :pagination rescue_from NeatPages::OutOfBound, with: :render_out_of_bound end def paginate(options={}) options.reverse_merge! per_page: 20 @_env['neat_pages'] = NeatPages::Base.new(params[:page], options) end def pagination @_env['neat_pages'] end def render_out_of_bound render text: "out_of_bound", status: 404 end def set_pagination_header response.headers.merge! pagination.response_headers if pagination end end
Version data entries
3 entries across 3 versions & 1 rubygems