Permalink
Browse files

Merge pull request #5390 from arunagw/picked_commits

fix activerecord query_method regression with offset into Fixnum
  • Loading branch information...
2 parents 0533ee4 + a2c2f40 commit 1e2de2cb74088a4dda5799587530be63279cc9c8 @josevalim josevalim committed Mar 12, 2012
@@ -329,7 +329,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?
@@ -1185,6 +1185,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)

0 comments on commit 1e2de2c

Please sign in to comment.