Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

don't reinitialize the arel_table unless the table_name changes

  • Loading branch information...
commit dc73c2c38feb018da37eda0a23c9411e15888eeb 1 parent 7cca6a2
@dmathieu dmathieu authored tenderlove committed
Showing with 2 additions and 1 deletion.
  1. +2 −1  activerecord/lib/active_record/base.rb
View
3  activerecord/lib/active_record/base.rb
@@ -659,6 +659,7 @@ def reset_sequence_name #:nodoc:
def set_table_name(value = nil, &block)
@quoted_table_name = nil
define_attr_method :table_name, value, &block
+ @arel_table = nil
@arel_table = Arel::Table.new(table_name, arel_engine)
@relation = Relation.new(self, arel_table)
@@ -892,7 +893,7 @@ def sti_name
end
def arel_table
- Arel::Table.new(table_name, arel_engine)
+ @arel_table ||= Arel::Table.new(table_name, arel_engine)
end
def arel_engine
Please sign in to comment.
Something went wrong with that request. Please try again.