aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-30 08:45:40 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-30 08:45:40 -0700
commit67a3a702951dae905b6270d652dbd14853b01c26 (patch)
treeb7ccc2eb644d9d17662d1fee7bd0ccca259b49dd /activerecord
parent0bb85ed9ffa9808926b46e8f7e59cab5b85ac19f (diff)
downloadrails-67a3a702951dae905b6270d652dbd14853b01c26.tar.gz
rails-67a3a702951dae905b6270d652dbd14853b01c26.tar.bz2
rails-67a3a702951dae905b6270d652dbd14853b01c26.zip
refactoring find_join_association
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index b8cd2aa31e..dc466eafc2 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1960,12 +1960,13 @@ module ActiveRecord
end
def find_join_association(name_or_reflection, parent)
- case name_or_reflection
- when Symbol, String
- join_associations.detect {|j| (j.reflection.name == name_or_reflection.to_s.intern) && (j.parent == parent)}
- else
- join_associations.detect {|j| (j.reflection == name_or_reflection) && (j.parent == parent)}
+ if String === name_or_reflection
+ name_or_reflection = name_or_reflection.to_sym
end
+
+ join_associations.detect { |j|
+ j.reflection == name_or_reflection && j.parent == parent
+ }
end
def remove_uniq_by_reflection(reflection, records)