new(name, scope, options, active_record) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/reflection.rb, line 414
      def initialize(name, scope, options, active_record)
        super
        @type         = options[:as] && (options[:foreign_type] || "#{options[:as]}_type")
        @foreign_type = options[:foreign_type] || "#{name}_type"
        @constructable = calculate_constructable(macro, options)
        @association_scope_cache = {}
        @scope_lock = Mutex.new

        if options[:class_name] && options[:class_name].class == Class
          ActiveSupport::Deprecation.warn(            Passing a class to the `class_name` is deprecated and will raise            an ArgumentError in Rails 5.2. It eagerloads more classes than            necessary and potentially creates circular dependencies.            Please pass the class name as a string:            `#{macro} :#{name}, class_name: '#{options[:class_name]}'`.squish)
        end
      end
Register or log in to add new notes.