Set_belongs_to_association_for

I have a question on
“ActiveRecord::Associations::AssociationProxy.set_belongs_to_association_for”
it is a protected method.

    def set_belongs_to_association_for(record)
      if @reflection.options[:as]
        record["#{@reflection.options[:as]}_id"]   = @owner.id

unless @owner.new_record?
record["#{@reflection.options[:as]}_type"] =
@owner.class.base_class.name.to_s
else
record[@reflection.primary_key_name] = @owner.id unless
@owner.new_record?
end
end

I was wondering why class.base_name was used for the record type and
not class.name?

Mehmet

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs