Class: Decidim::AuthorizationTransferRecord

Inherits:
ApplicationRecord show all
Defined in:
app/models/decidim/authorization_transfer_record.rb

Overview

Represents an authorization transfer record, i.e. a Decidim record object which was transferred from another user to the target user during an authorization transfer.

Instance Method Summary collapse

Instance Method Details

#readonly?Boolean

Overwrites the method so that records cannot be modified.

Returns:

  • (Boolean)

    a boolean indicating whether the record is read only.



14
15
16
# File 'app/models/decidim/authorization_transfer_record.rb', line 14

def readonly?
  !new_record? && !destroyed_by_association
end

#typeString

Returns the resource type for the records which is the value of the resource_type column stored for the record or the mapped_resource_type for the resource if it responds to that method.

For example, Decidim::Coauthorable records need to report a model that they represent instead of “Coauthorable” because otherwise e.g. proposal transfers would not be reported correctly.

Returns:

  • (String)

    The resource type as string.



27
28
29
# File 'app/models/decidim/authorization_transfer_record.rb', line 27

def type
  resource.try(:mapped_resource_type) || resource_type
end