Permalink
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...
1 parent bccffc9 commit b1fe2c66065df1d76181636085a3509702b231a4 @denisj denisj committed with arunagw Jan 11, 2012
@@ -206,7 +206,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?
@@ -1172,6 +1172,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 b1fe2c6

Please sign in to comment.