Sha256: a8bf6c09805878e132fb71e00313241cdca8600c36590979f8a3b6e46e59365b

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

Contents

# Loads extensions to Ruby on Rails libraries needed to support pagination and lazy loading
require 'active_record/base_extensions'
require 'active_record/scope_extensions'

# Loads
require 'action_controller/rescue_with_helper'

# Loads internal pagination classes
require 'pagination/collection'
require 'pagination/named_scope'
require 'pagination/enumerable'
require 'pagination/view_helpers'

# Loads the :paginate view helper
ActionView::Base.send :include, Pagination::ViewHelpers

# Load :rescue_with_handler - solution: https://rails.lighthouseapp.com/projects/8994/tickets/2034-exceptions-in-views-hard-to-catch
ActionController::Base.send :include, RescueWithHelper

ActionController::Base.send(:rescue_from, Pagination::InvalidPage, :with => :not_found)

def not_found
  # Avoid calling '304 Not Modified'
  if stale?(:etag => "invalid_page", :last_modified => DateTime.now.utc)
    render_optional_error_file 404
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
objectreload-pagination-0.1.9 lib/pagination.rb