don't reinitialize the arel_table unless the table_name changes

This commit is contained in:
Damien Mathieu
2011-06-09 09:01:50 +02:00
committed by Aaron Patterson
parent 35ae29f305
commit 84f71e42b7

View File

@@ -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