diff options
author | José Valim <jose.valim@gmail.com> | 2012-03-13 01:48:08 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-03-13 01:48:08 -0700 |
commit | a9320f7c0bb27e41dc7c3bacc5084341c6aac2bc (patch) | |
tree | 800057ac2562ad0abe8d800cdb98e20d978e9249 | |
parent | 5f26ce699f9e695c434cbff20626a9ff4d3114e4 (diff) | |
parent | f67944e7579711e2c28ea8b48ec739c1ff1966ae (diff) | |
download | rails-a9320f7c0bb27e41dc7c3bacc5084341c6aac2bc.tar.gz rails-a9320f7c0bb27e41dc7c3bacc5084341c6aac2bc.tar.bz2 rails-a9320f7c0bb27e41dc7c3bacc5084341c6aac2bc.zip |
Merge pull request #5400 from arunagw/issue_4409
Issue 4409
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index fab2cd77f0..f5bfa3603a 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -270,7 +270,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? diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 173044fc94..4705252c05 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -1204,6 +1204,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) |