diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-21 20:38:36 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-21 20:38:36 -0700 |
commit | 723adecab9439775452978e82be421ea2e257133 (patch) | |
tree | 196da125c1d8a9a1b66110cc9f6d7062400026e0 | |
parent | 9b1a4fda6fa8c98fff7ee3d4e781e90cae01a98c (diff) | |
download | rails-723adecab9439775452978e82be421ea2e257133.tar.gz rails-723adecab9439775452978e82be421ea2e257133.tar.bz2 rails-723adecab9439775452978e82be421ea2e257133.zip |
fixing case / when indentation
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index acc5bac1ad..3b02a30915 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1977,25 +1977,25 @@ module ActiveRecord def construct_association(record, join, row) case join.reflection.macro - when :has_many, :has_and_belongs_to_many - collection = record.send(join.reflection.name) - collection.loaded - - return nil if record.id.to_s != join.parent.record_id(row).to_s or row[join.aliased_primary_key].nil? - association = join.instantiate(row) - collection.target.push(association) - collection.__send__(:set_inverse_instance, association, record) - when :has_one - return if record.id.to_s != join.parent.record_id(row).to_s - return if record.instance_variable_defined?("@#{join.reflection.name}") - association = join.instantiate(row) unless row[join.aliased_primary_key].nil? - set_target_and_inverse(join, association, record) - when :belongs_to - return if record.id.to_s != join.parent.record_id(row).to_s or row[join.aliased_primary_key].nil? - association = join.instantiate(row) - set_target_and_inverse(join, association, record) - else - raise ConfigurationError, "unknown macro: #{join.reflection.macro}" + when :has_many, :has_and_belongs_to_many + collection = record.send(join.reflection.name) + collection.loaded + + return nil if record.id.to_s != join.parent.record_id(row).to_s or row[join.aliased_primary_key].nil? + association = join.instantiate(row) + collection.target.push(association) + collection.__send__(:set_inverse_instance, association, record) + when :has_one + return if record.id.to_s != join.parent.record_id(row).to_s + return if record.instance_variable_defined?("@#{join.reflection.name}") + association = join.instantiate(row) unless row[join.aliased_primary_key].nil? + set_target_and_inverse(join, association, record) + when :belongs_to + return if record.id.to_s != join.parent.record_id(row).to_s or row[join.aliased_primary_key].nil? + association = join.instantiate(row) + set_target_and_inverse(join, association, record) + else + raise ConfigurationError, "unknown macro: #{join.reflection.macro}" end return association end |