aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)