diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-21 01:28:50 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-21 01:28:50 +0530 |
commit | 798d2828dc28a596a9980a149a2d1210f32078d9 (patch) | |
tree | 5a6463fbf0cafb6b51e8516b00e1e95b0b6ea100 /activerecord/lib | |
parent | 24cc9e5b4f9b729f02d2e0b56265032d08933a41 (diff) | |
download | rails-798d2828dc28a596a9980a149a2d1210f32078d9.tar.gz rails-798d2828dc28a596a9980a149a2d1210f32078d9.tar.bz2 rails-798d2828dc28a596a9980a149a2d1210f32078d9.zip |
Cache quoted_table_name
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 79ec171861..bc1b0bde31 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -906,6 +906,10 @@ module ActiveRecord #:nodoc: reset_table_name end + def quoted_table_name + @quoted_table_name ||= connection.quote_table_name(table_name) + end + def reset_table_name #:nodoc: base = base_class @@ -923,6 +927,7 @@ module ActiveRecord #:nodoc: name = "#{table_name_prefix}#{contained}#{undecorated_table_name(base.name)}#{table_name_suffix}" end + @quoted_table_name = nil set_table_name(name) name end @@ -2329,10 +2334,6 @@ module ActiveRecord #:nodoc: hash.inject([]) { |list, pair| list << "#{pair.first} = #{pair.last}" }.join(", ") end - def self.quoted_table_name - self.connection.quote_table_name(self.table_name) - end - def quote_columns(quoter, hash) hash.inject({}) do |quoted, (name, value)| quoted[quoter.quote_column_name(name)] = value |