Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix activerecord query_method regression with offset into Fixnum

add test to show offset query_methods on mysql & mysql2

change test to cover public API
  • Loading branch information...
commit f67944e7579711e2c28ea8b48ec739c1ff1966ae 1 parent 5f26ce6
Denis Jean denisj authored arunagw committed
2  activerecord/lib/active_record/relation/query_methods.rb
View
@@ -270,7 +270,7 @@ def build_arel
arel.having(*@having_values.uniq.reject{|h| h.blank?}) unless @having_values.empty?
arel.take(connection.sanitize_limit(@limit_value)) if @limit_value
- arel.skip(@offset_value) if @offset_value
+ arel.skip(@offset_value.to_i) if @offset_value
arel.group(*@group_values.uniq.reject{|g| g.blank?}) unless @group_values.empty?
4 activerecord/test/cases/finder_test.rb
View
@@ -1204,6 +1204,10 @@ def test_find_one_message_with_custom_primary_key
end
end
+ def test_finder_with_offset_string
+ assert_nothing_raised(ActiveRecord::StatementInvalid) { Topic.find(:all, :offset => "3") }
+ end
+
protected
def bind(statement, *vars)
if vars.first.is_a?(Hash)
Please sign in to comment.
Something went wrong with that request. Please try again.