From e204f80dbb2134867b006d02c4d5d15c265351b8 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 27 Aug 2009 16:42:57 -0300 Subject: Performance: Don't reload the ARel relation on create, do it on reset_column_information. --- activerecord/lib/active_record/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/base.rb') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 0307aa29d3..4e2261d044 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1365,6 +1365,8 @@ module ActiveRecord #:nodoc: # end def reset_column_information undefine_attribute_methods + # Reload ARel relation cached table + arel_table(table_name, true) @column_names = @columns = @columns_hash = @content_columns = @dynamic_methods_hash = @inheritance_column = nil end @@ -2877,8 +2879,6 @@ module ActiveRecord #:nodoc: self.id = connection.next_sequence_value(self.class.sequence_name) end - # Reload ARel relation cached table - self.class.arel_table(self.class.table_name, true) attributes_values = arel_attributes_values new_id = if attributes_values.empty? -- cgit v1.2.3