aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2010-01-27 19:33:03 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2010-01-27 19:33:03 -0800
commitfd0eb3d904235e8ebf21d6e79d45096d4c9c71bf (patch)
treeed78ade3e6f2d30844bd1980e056d2e5f35013bb /activerecord/lib
parent187b3b0b4808c2daf015699dfa1e5a78605072a7 (diff)
downloadrails-fd0eb3d904235e8ebf21d6e79d45096d4c9c71bf.tar.gz
rails-fd0eb3d904235e8ebf21d6e79d45096d4c9c71bf.tar.bz2
rails-fd0eb3d904235e8ebf21d6e79d45096d4c9c71bf.zip
Clear up some ivar warnings
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb16
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