From 64435418e173bb6eaf89a3f6f06b10fcb1c4b41b Mon Sep 17 00:00:00 2001 From: Jean-Denis Vauguet Date: Sun, 26 Jul 2009 04:12:53 +0200 Subject: [PATCH] force create() to fetch quoted attributes once create() first fetches quoted attributes with attributes_with_quotes. It then may build a custom SQL statement, where quoted_column_names() is called. This in turns triggers a second call to attributes_with_quotes for it's used as the default parameter of the method. This single-line patch prevents from calling it twice by supplying the fetched quoted attributes as the parameter when calling quoted_column_names(). --- activerecord/lib/active_record/base.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 5a36ff5..49de027 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2967,7 +2967,7 @@ module ActiveRecord #:nodoc: connection.empty_insert_statement(self.class.table_name) else "INSERT INTO #{self.class.quoted_table_name} " + - "(#{quoted_column_names.join(', ')}) " + + "(#{quoted_column_names(quoted_attributes).join(', ')}) " + "VALUES(#{quoted_attributes.values.join(', ')})" end -- 1.5.6.3