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
This commit is contained in:
Denis Jean 2012-01-11 12:45:55 +01:00 committed by Arun Agrawal
parent 0533ee45a7
commit a2c2f40661
2 changed files with 5 additions and 1 deletions

View File

@ -329,7 +329,7 @@ module ActiveRecord
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?

View File

@ -1185,6 +1185,10 @@ class FinderTest < ActiveRecord::TestCase
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)