Module: RailsPaginate
- Defined in:
- lib/rails_paginate.rb,
lib/rails_paginate/rails.rb,
lib/rails_paginate/pagers.rb,
lib/rails_paginate/helpers.rb,
lib/rails_paginate/renderers.rb,
lib/rails_paginate/collection.rb,
lib/generators/rails_paginate/install_generator.rb
Overview
nice rails paginate plugin
Defined Under Namespace
Modules: Generators, Helpers, Pagers, Renderers Classes: Collection, Engine
Constant Summary collapse
- @@page_param =
:page
- @@per_page =
20
- @@default_renderer =
:html_default
- @@default_pager =
:slider
Class Method Summary collapse
-
.init ⇒ Object
init rails paginate.
-
.pager(pager) ⇒ Object
return pager.
-
.renderer(renderer) ⇒ Object
return renderer.
-
.setup {|_self| ... } ⇒ Object
to configure rails_paginate for a sample look the readme.rdoc file.
Class Method Details
.init ⇒ Object
init rails paginate
58 59 60 61 62 63 64 |
# File 'lib/rails_paginate.rb', line 58 def init require 'rails_paginate/rails' if defined?(::Rails::Engine) ::Array.send(:include, Helpers::Array) ::ActiveRecord::Base.send(:extend, Helpers::ActiveRecord) if defined?(::ActiveRecord::Base) ::ActiveRecord::Relation.send(:include, Helpers::ActiveRecord) if defined?(::ActiveRecord::Relation) ::ActionView::Base.send(:include, Helpers::ActionView) if defined?(::ActionView::Base) end |
.pager(pager) ⇒ Object
return pager
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rails_paginate.rb', line 46 def pager(pager) raise ArgumentError, "pager #{pager} is not valid" unless (pager.is_a? Symbol or pager.is_a? String or pager.is_a? Class) pager = pager.to_s if pager.is_a? Symbol pager = "rails_paginate/pagers/#{pager}".camelize.constantize if pager.is_a? String if block_given? yield pager else pager end end |
.renderer(renderer) ⇒ Object
return renderer
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rails_paginate.rb', line 34 def renderer(renderer) raise ArgumentError, "renderer #{renderer} is not valid" unless (renderer.is_a? Symbol or renderer.is_a? String or renderer.is_a? Class) renderer = renderer.to_s if renderer.is_a? Symbol renderer = "rails_paginate/renderers/#{renderer}".camelize.constantize if renderer.is_a? String if block_given? yield renderer else renderer end end |
.setup {|_self| ... } ⇒ Object
to configure rails_paginate for a sample look the readme.rdoc file
29 30 31 |
# File 'lib/rails_paginate.rb', line 29 def setup yield self end |