Skip to content

Commit

Permalink
replaced enumerable #count for #size (suggested in #112)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Dec 10, 2018
1 parent 0723228 commit 01178cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/pagy/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def pagy(collection, vars={})

# Sub-method called only by #pagy: here for easy customization of variables by overriding
def pagy_get_vars(collection, vars)
vars[:count] ||= (c = collection.count(:all)).is_a?(Hash) ? c.count : c
vars[:count] ||= (c = collection.count(:all)).is_a?(Hash) ? c.size : c
vars[:page] ||= params[ vars[:page_param] || VARS[:page_param] ]
vars
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pagy/extras/array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def pagy_array(array, vars={})

# Sub-method called only by #pagy_array: here for easy customization of variables by overriding
def pagy_array_get_vars(array, vars)
vars[:count] ||= array.count
vars[:count] ||= array.size
vars[:page] ||= params[ vars[:page_param] || VARS[:page_param] ]
vars
end
Expand Down

0 comments on commit 01178cb

Please sign in to comment.