Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #14668 from laurocaetano/source_option_with_string…

…_value

The :source option for has_many => through should accept String values.
  • Loading branch information...
commit e46ff16993acee6494f159277d4677085a9b04b2 1 parent 58e53c2
@tenderlove tenderlove authored rafaelfranca committed
View
2  activerecord/lib/active_record/reflection.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|
View
4 activerecord/test/models/tag.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.