diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-02-03 13:27:23 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-02-03 13:38:14 +0100 |
commit | b7c7cb1a6379f861c04a1273c67fa8b46212f527 (patch) | |
tree | d779ee452358e46750ab62a082efe0d23cfec797 | |
parent | c46b0d1023490bdbfac6b0db6426b3bf8075ebeb (diff) | |
download | rails-b7c7cb1a6379f861c04a1273c67fa8b46212f527.tar.gz rails-b7c7cb1a6379f861c04a1273c67fa8b46212f527.tar.bz2 rails-b7c7cb1a6379f861c04a1273c67fa8b46212f527.zip |
docs, revisit polymorphic associations with STI example. [ci skip]
This is a follow up to #13926.
/cc @fxn
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 051f7dff53..918806e8b4 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -669,11 +669,14 @@ module ActiveRecord # and member posts that use the posts table for STI. In this case, there must be a +type+ # column in the posts table. # + # Note: The <tt>attachable_type=</tt> method is being called when assigning an +attachable+. + # The +class_name+ of the +attachable+ is being passed as a String. + # # class Asset < ActiveRecord::Base # belongs_to :attachable, polymorphic: true # - # def attachable_type=(klass) - # super(klass.to_s.classify.constantize.base_class.to_s) + # def attachable_type=(class_name) + # super(class_name.constantize.base_class.to_s) # end # end # |