diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-24 14:11:12 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-24 14:11:12 -0800 |
commit | 38eb01863c9281d142c6494bae485b9c215ec9b7 (patch) | |
tree | 10c1db0e2c85d48b10f2aee0db1c9e9bc3141992 /activerecord/lib | |
parent | 34d21b87bb237bf55214bd476be71116a2a5258f (diff) | |
download | rails-38eb01863c9281d142c6494bae485b9c215ec9b7.tar.gz rails-38eb01863c9281d142c6494bae485b9c215ec9b7.tar.bz2 rails-38eb01863c9281d142c6494bae485b9c215ec9b7.zip |
initialize instance variables in initialize... o_O
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/class_methods/join_dependency/join_part.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/class_methods/join_dependency/join_part.rb b/activerecord/lib/active_record/associations/class_methods/join_dependency/join_part.rb index 5d55ca202e..0b093b65e9 100644 --- a/activerecord/lib/active_record/associations/class_methods/join_dependency/join_part.rb +++ b/activerecord/lib/active_record/associations/class_methods/join_dependency/join_part.rb @@ -19,6 +19,7 @@ module ActiveRecord def initialize(active_record) @active_record = active_record @cached_record = {} + @column_names_with_alias = nil end def aliased_table @@ -51,14 +52,13 @@ module ActiveRecord # An array of [column_name, alias] pairs for the table def column_names_with_alias - unless defined?(@column_names_with_alias) + unless @column_names_with_alias @column_names_with_alias = [] ([primary_key] + (column_names - [primary_key])).each_with_index do |column_name, i| @column_names_with_alias << [column_name, "#{aliased_prefix}_r#{i}"] end end - @column_names_with_alias end |