diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-03-22 15:43:14 -0300 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-03-22 11:48:39 -0700 |
commit | d289e15af9b2749ba0ab9534b5469287be6ece05 (patch) | |
tree | dad2341e838d68d0a7441137369137d3bd65ed5a /activerecord/lib/active_record/relation/query_methods.rb | |
parent | 4f5de7f89a359924abe21949e0f585682c04dd9f (diff) | |
download | rails-d289e15af9b2749ba0ab9534b5469287be6ece05.tar.gz rails-d289e15af9b2749ba0ab9534b5469287be6ece05.tar.bz2 rails-d289e15af9b2749ba0ab9534b5469287be6ece05.zip |
From and lock should be defined to be consistent with other ivars. Limit and offset are always defined, no need to test that.
[#4253 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib/active_record/relation/query_methods.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index f7cf68665d..0250e739b8 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -134,13 +134,8 @@ module ActiveRecord arel = h.is_a?(String) ? arel.having(h) : arel.having(*h) end - 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 + arel = arel.take(@limit_value) if @limit_value.present? + arel = arel.skip(@offset_value) if @offset_value.present? @group_values.uniq.each do |g| arel = arel.group(g) if g.present? @@ -163,19 +158,14 @@ module ActiveRecord arel = arel.project(quoted_table_name + '.*') end - arel = - if defined?(@from_value) && @from_value.present? - arel.from(@from_value) - else - arel.from(quoted_table_name) - end + arel = @from_value.present? ? arel.from(@from_value) : arel.from(quoted_table_name) case @lock_value when TrueClass arel = arel.lock when String arel = arel.lock(@lock_value) - end if defined?(@lock_value) + end if @lock_value.present? arel end |