diff options
author | Stefan Penner <stefan.penner@gmail.com> | 2010-01-27 22:44:56 -0600 |
---|---|---|
committer | Stefan Penner <stefan.penner@gmail.com> | 2010-01-27 22:44:56 -0600 |
commit | 3aa1ea1ae4baa4a03d03644e798eeb98a4745785 (patch) | |
tree | 199dab8c28aa5476373af32000159f38cda04cdc /activerecord/lib/active_record | |
parent | 2ec99192d59e3f901b301d5735cee9a0b9ee091a (diff) | |
parent | 2c12a71378d2146c822acb389b00b866f6420ff5 (diff) | |
download | rails-3aa1ea1ae4baa4a03d03644e798eeb98a4745785.tar.gz rails-3aa1ea1ae4baa4a03d03644e798eeb98a4745785.tar.bz2 rails-3aa1ea1ae4baa4a03d03644e798eeb98a4745785.zip |
Merge branch 'rails/master' into ujs
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 8954f2d12b..0266700f66 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -133,8 +133,13 @@ module ActiveRecord arel = h.is_a?(String) ? arel.having(h) : arel.having(*h) end - arel = arel.take(@limit_value) if @limit_value.present? - arel = arel.skip(@offset_value) if @offset_value.present? + if defined?(@limit_value) && @limit_value.present? + arel = arel.take(@limit_value) + end + + if defined?(@offset_value) && @offset_value.present? + arel = arel.skip(@offset_value) + end @group_values.uniq.each do |g| arel = arel.group(g) if g.present? @@ -157,7 +162,12 @@ module ActiveRecord arel = arel.project(quoted_table_name + '.*') end - arel = @from_value.present? ? arel.from(@from_value) : arel.from(quoted_table_name) + arel = + if defined?(@from_value) && @from_value.present? + arel.from(@from_value) + else + arel.from(quoted_table_name) + end case @lock_value when TrueClass |