diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-17 03:14:17 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-17 03:14:17 +0530 |
commit | 6e3bee6cf1f0d2684152292db0a8b757249824fd (patch) | |
tree | 0fa2b07d24e281ec0e9407a66aa7eb252cbefcca /activerecord/lib | |
parent | 6806483b913aba611af48c1630f229a76a98ecc7 (diff) | |
download | rails-6e3bee6cf1f0d2684152292db0a8b757249824fd.tar.gz rails-6e3bee6cf1f0d2684152292db0a8b757249824fd.tar.bz2 rails-6e3bee6cf1f0d2684152292db0a8b757249824fd.zip |
Cache Model.arel_table
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 3c4a9fe99d..82e91a80ad 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1388,7 +1388,7 @@ module ActiveRecord #:nodoc: def reset_column_information undefine_attribute_methods @column_names = @columns = @columns_hash = @content_columns = @dynamic_methods_hash = @inheritance_column = nil - @arel_engine = @unscoped = nil + @arel_engine = @unscoped = @arel_table = nil end def reset_column_information_and_inheritable_attributes_for_all_subclasses#:nodoc: @@ -1506,8 +1506,8 @@ module ActiveRecord #:nodoc: finder_needs_type_condition? ? @unscoped.where(type_condition) : @unscoped end - def arel_table(table_name_alias = nil) - Arel::Table.new(table_name, :as => table_name_alias, :engine => arel_engine) + def arel_table + @arel_table ||= Arel::Table.new(table_name, :engine => arel_engine) end def arel_engine |