diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-09-08 05:50:12 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-09-08 05:50:12 +0900 |
commit | a6860e0f0f2df99ac3859433b471692e6b598cbf (patch) | |
tree | e3d97d931f6370da9c5259196feaa61d5c1a48ae /activerecord/lib | |
parent | b3f702febfdc6425b89a6a3b3040d0ecc963f41f (diff) | |
download | rails-a6860e0f0f2df99ac3859433b471692e6b598cbf.tar.gz rails-a6860e0f0f2df99ac3859433b471692e6b598cbf.tar.bz2 rails-a6860e0f0f2df99ac3859433b471692e6b598cbf.zip |
Remove duplicated `klass` method in `AssociationReflection`
The superclass (`MacroReflection`) already have the same method
definition.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 3ef4992d80..889e24dd1a 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -365,6 +365,17 @@ module ActiveRecord # # <tt>composed_of :balance, class_name: 'Money'</tt> returns the Money class # <tt>has_many :clients</tt> returns the Client class + # + # class Company < ActiveRecord::Base + # has_many :clients + # end + # + # Company.reflect_on_association(:clients).klass + # # => Client + # + # <b>Note:</b> Do not call +klass.new+ or +klass.create+ to instantiate + # a new association object. Use +build_association+ or +create_association+ + # instead. This allows plugins to hook into association object creation. def klass @klass ||= compute_class(class_name) end @@ -405,22 +416,6 @@ module ActiveRecord # Holds all the metadata about an association as it was specified in the # Active Record class. class AssociationReflection < MacroReflection #:nodoc: - # Returns the target association's class. - # - # class Author < ActiveRecord::Base - # has_many :books - # end - # - # Author.reflect_on_association(:books).klass - # # => Book - # - # <b>Note:</b> Do not call +klass.new+ or +klass.create+ to instantiate - # a new association object. Use +build_association+ or +create_association+ - # instead. This allows plugins to hook into association object creation. - def klass - @klass ||= compute_class(class_name) - end - def compute_class(name) active_record.send(:compute_type, name) end |