Skip to content

Commit

Permalink
add .filter_without_pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
ajb committed Aug 7, 2015
1 parent 9446767 commit 68e6008
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/filterer/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ def filter(params = {}, opts = {})
new(params, opts).results
end

# @return [ActiveRecord::Association]
def filter_without_pagination(params = {}, opts = {})
new(params, opts.merge(
skip_pagination: true
)).results
end

# @return [ActiveRecord::Association]
def chain(params = {}, opts = {})
new(params, opts.merge(
Expand Down
2 changes: 1 addition & 1 deletion lib/filterer/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Filterer
VERSION = '1.0.0'
VERSION = '1.0.1'
end
6 changes: 6 additions & 0 deletions spec/lib/filterer/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -375,5 +375,11 @@ def starting_query
expect_any_instance_of(DefaultParamsFilterer).to_not receive(:paginate_results)
filterer = DefaultParamsFilterer.chain({})
end

it 'provides a helper method to skip pagination' do
expect_any_instance_of(DefaultParamsFilterer).to receive(:order_results)
expect_any_instance_of(DefaultParamsFilterer).to_not receive(:paginate_results)
filterer = DefaultParamsFilterer.filter_without_pagination({})
end
end
end

0 comments on commit 68e6008

Please sign in to comment.