diff options
author | Damien Mathieu <42@dmathieu.com> | 2011-06-09 09:01:50 +0200 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-09 14:56:07 -0700 |
commit | 84f71e42b79f00a97e95f6f472903b553ceda8ef (patch) | |
tree | 3983130481a192c567ca1c20d835cdc89f535967 /activerecord/lib | |
parent | 35ae29f305d007884c0757dfd5774b8d7acd141d (diff) | |
download | rails-84f71e42b79f00a97e95f6f472903b553ceda8ef.tar.gz rails-84f71e42b79f00a97e95f6f472903b553ceda8ef.tar.bz2 rails-84f71e42b79f00a97e95f6f472903b553ceda8ef.zip |
don't reinitialize the arel_table unless the table_name changes
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 900abd323b..2f283ff6bc 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -659,6 +659,7 @@ module ActiveRecord #:nodoc: def set_table_name(value = nil, &block) @quoted_table_name = nil define_attr_method :table_name, value, &block + @arel_table = nil @relation = Relation.new(self, arel_table) end @@ -891,7 +892,7 @@ module ActiveRecord #:nodoc: end def arel_table - Arel::Table.new(table_name, arel_engine) + @arel_table ||= Arel::Table.new(table_name, arel_engine) end def arel_engine |