method

creation_attributes

rails latest stable - Class: ActiveRecord::Associations::Association

Method deprecated or moved

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

creation_attributes()
private

No documentation available.

# File activerecord/lib/active_record/associations/association.rb, line 239
        def creation_attributes
          attributes = {}

          if (reflection.has_one? || reflection.collection?) && !options[:through]
            attributes[reflection.foreign_key] = owner[reflection.active_record_primary_key]

            if reflection.type
              attributes[reflection.type] = owner.class.polymorphic_name
            end
          end

          attributes
        end