Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type cast pagy_arel_count value to integer #207

Merged
merged 1 commit into from
Dec 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Type cast pagy_arel_count value to integer
Otherwise it will complain about "expected :count >= 0; got nil"
  • Loading branch information
rainerborene authored Dec 5, 2019
commit 380d319d9f45259d29adb08e19c6a9a05435b127
2 changes: 1 addition & 1 deletion lib/pagy/extras/arel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def pagy_arel_count(collection)
else
# COUNT(*) OVER ()
sql = Arel.star.count.over(Arel::Nodes::Grouping.new([]))
collection.unscope(:order).limit(1).pluck(sql).first
collection.unscope(:order).limit(1).pluck(sql).first.to_i
end
end

Expand Down