Skip to content

Commit

Permalink
Some more tweaks to filter paging #160
Browse files Browse the repository at this point in the history
  • Loading branch information
cofiem committed Mar 7, 2015
1 parent b5bea0a commit f4ff2c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/modules/filter/parse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def parse_paging(params, default_page, default_items, max_items)
items = default_items if items.blank?

# parse disable paging settings
if disable_paging == 'true'
if disable_paging == 'true' || disable_paging == true
disable_paging = true
else
disable_paging = false
end

# ensure items is always less than max_items
items = max_items if items.to_i > max_items
fail CustomErrors::UnprocessableEntityError, "Number of items requested #{items} exceeded maximum #{max_items}." if items.to_i > max_items

# calculate offset if able
offset = (page - 1) * items
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/filter/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def has_paging_params?
end

def is_paging_disabled?
@paging[:disable_paging]
@paging[:disable_paging] == 'true' || @paging[:disable_paging] == true
end

def has_sort_params?
Expand Down

0 comments on commit f4ff2c3

Please sign in to comment.