diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-07 11:28:11 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-07 11:28:11 -0800 |
commit | 839f3bf6822ed3698df1e606c4215d650312f33e (patch) | |
tree | 1f53277c77c8b64679f9bfda1e184a0c4ce91730 /activerecord/lib/active_record/associations/class_methods | |
parent | 8a1c5337808c53c5e9d2d842a09a90599c497e89 (diff) | |
download | rails-839f3bf6822ed3698df1e606c4215d650312f33e.tar.gz rails-839f3bf6822ed3698df1e606c4215d650312f33e.tar.bz2 rails-839f3bf6822ed3698df1e606c4215d650312f33e.zip |
just use a hash for doing association caching
Diffstat (limited to 'activerecord/lib/active_record/associations/class_methods')
-rw-r--r-- | activerecord/lib/active_record/associations/class_methods/join_dependency.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/class_methods/join_dependency.rb b/activerecord/lib/active_record/associations/class_methods/join_dependency.rb index bb6145656e..6263c4e3b0 100644 --- a/activerecord/lib/active_record/associations/class_methods/join_dependency.rb +++ b/activerecord/lib/active_record/associations/class_methods/join_dependency.rb @@ -176,7 +176,7 @@ module ActiveRecord join_part = join_parts.detect { |j| j.reflection.name.to_s == name && - j.parent_table_name == parent.class.table_name } + j.parent_table_name == parent.class.table_name } raise(ConfigurationError, "No such association") unless join_part @@ -201,7 +201,7 @@ module ActiveRecord macro = join_part.reflection.macro if macro == :has_one - return if record.instance_variable_defined?("@#{join_part.reflection.name}") + return if record.association_cache.key?(join_part.reflection.name) association = join_part.instantiate(row) unless row[join_part.aliased_primary_key].nil? set_target_and_inverse(join_part, association, record) else |