Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Commit

Permalink
Use count(:all) to fix issue of Geocoder with Rails 4.1
Browse files Browse the repository at this point in the history
[#107064082]
Due to the update to Rails 4.1, Geocoder has a issue with regards
to its SQL composition. This causes a syntax error to Geocoder's
Location-based queries.

Issue can be found here:
alexreisner/geocoder#630
  • Loading branch information
Jess Chin and Neil Marion dela Cruz authored and ramontayag committed Nov 4, 2015
1 parent dea93bc commit f168372
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/active_model/pagination_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def initialize_with_pagination(object, opts={})
per_page = object.limit_value
offset = object.offset_value
current_page = offset ? (offset / per_page) + 1 : 1
total_items = object.limit(nil).offset(nil).count
total_items = object.limit(nil).offset(nil).count(:all)
total_pages = per_page ? (total_items / per_page.to_f).ceil : 1
prev_page = current_page - 1
prev_page = nil if prev_page < 1
Expand Down

0 comments on commit f168372

Please sign in to comment.