aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-06-12 18:56:23 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-06-12 18:56:23 -0700
commitb3bc3aa5cbe7540de21ae4eb566886e3b8efe6e3 (patch)
tree86c2908b9ad39b288aae4df406a94aa5c3a30bbf
parent9e7040d8a01819391c77a34fd185595d845f3aae (diff)
downloadrails-b3bc3aa5cbe7540de21ae4eb566886e3b8efe6e3.tar.gz
rails-b3bc3aa5cbe7540de21ae4eb566886e3b8efe6e3.tar.bz2
rails-b3bc3aa5cbe7540de21ae4eb566886e3b8efe6e3.zip
sometimes singularize does not work, so we get a list of two strings. just uniq them
-rw-r--r--activerecord/lib/active_record/reflection.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index f5ea0edb72..2aec73bd5b 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -635,7 +635,7 @@ module ActiveRecord
# # => [:tag, :tags]
#
def source_reflection_names
- @source_reflection_names ||= (options[:source] ? [options[:source]] : [name.to_s.singularize, name]).collect { |n| n.to_sym }
+ @source_reflection_names ||= (options[:source] ? [options[:source]] : [name.to_s.singularize, name]).collect { |n| n.to_sym }.uniq
end
def source_options