diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-21 01:36:56 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-21 01:37:02 +0530 |
commit | fa9f000246c2f6010f18bf40237d105b782873e2 (patch) | |
tree | b6e063b24ed61652d7e6103788e4f69d6752f7c9 /activerecord/lib | |
parent | 798d2828dc28a596a9980a149a2d1210f32078d9 (diff) | |
download | rails-fa9f000246c2f6010f18bf40237d105b782873e2.tar.gz rails-fa9f000246c2f6010f18bf40237d105b782873e2.tar.bz2 rails-fa9f000246c2f6010f18bf40237d105b782873e2.zip |
Use quoted_table_name with arel.from() if no from values explicitly supplied. Arel seems to be spending a lot of time figuring out the FROM value otherwise.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 0cfe629c07..d0689cd93e 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -140,16 +140,18 @@ module ActiveRecord selects = @select_values.uniq + quoted_table_name = @klass.quoted_table_name + if selects.present? selects.each do |s| @implicit_readonly = false arel = arel.project(s) if s.present? end else - arel = arel.project(@klass.quoted_table_name + '.*') + arel = arel.project(quoted_table_name + '.*') end - arel = arel.from(@from_value) if @from_value.present? + arel = @from_value.present? ? arel.from(@from_value) : arel.from(quoted_table_name) case @lock_value when TrueClass |