Permalink
Browse files

The `source` option for `has_many => through` should accept String

values.

With the changes introduced by 16b70fd
it was expecting the value to be a Symbol, while it could be also a
String value.
  • Loading branch information...
1 parent 7b75b67 commit a91e5ff2cbf2f8971ad0d2a80b2e22e63b1900f6 @laurocaetano laurocaetano committed Apr 9, 2014
Showing with 3 additions and 3 deletions.
  1. +1 −1 activerecord/lib/active_record/reflection.rb
  2. +2 −2 activerecord/test/models/tag.rb
@@ -621,7 +621,7 @@ def source_reflection_names
end
def source_reflection_name # :nodoc:
- return @source_reflection_name if @source_reflection_name
+ return @source_reflection_name.to_sym if @source_reflection_name
names = [name.to_s.singularize, name].collect { |n| n.to_sym }.uniq
names = names.find_all { |n|
@@ -3,5 +3,5 @@ class Tag < ActiveRecord::Base
has_many :taggables, :through => :taggings
has_one :tagging
- has_many :tagged_posts, :through => :taggings, :source => :taggable, :source_type => 'Post'
-end
+ has_many :tagged_posts, :through => :taggings, :source => 'taggable', :source_type => 'Post'
+end

0 comments on commit a91e5ff

Please sign in to comment.