Class: ActiveSet::Paginating::ActiveRecordStrategy
- Inherits:
-
Object
- Object
- ActiveSet::Paginating::ActiveRecordStrategy
- Defined in:
- lib/active_set/paginating/active_record_strategy.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(set, operation_instructions) ⇒ ActiveRecordStrategy
constructor
A new instance of ActiveRecordStrategy.
Constructor Details
#initialize(set, operation_instructions) ⇒ ActiveRecordStrategy
Returns a new instance of ActiveRecordStrategy.
6 7 8 9 |
# File 'lib/active_set/paginating/active_record_strategy.rb', line 6 def initialize(set, operation_instructions) @set = set @operation_instructions = operation_instructions end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/active_set/paginating/active_record_strategy.rb', line 11 def execute return false unless @set.respond_to? :to_sql return @set.none if @set.length <= @operation_instructions[:size] && @operation_instructions[:page] > 1 @set.limit(@operation_instructions[:size]).offset(page_offset) end |