method

klass

rails latest stable - Class: ActiveRecord::Reflection::AssociationReflection

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v5.1.7) is shown here.

klass()
public

Returns the target association’s class.

class Author < ActiveRecord::Base
  has_many :books
end

Author.reflect_on_association(:books).klass
# => Book

Note: 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.