Class: PreparationType

Inherits:
ApplicationRecord show all
Includes:
Housekeeping::Timestamps, Housekeeping::Users, Shared::HasPapertrail, Shared::IsData, Shared::SharedAcrossProjects, Shared::Tags
Defined in:
app/models/preparation_type.rb

Overview

A PreparationType describes how a collection object was prepared for preservation in a collection. At present we’re building a shared controlled vocabulary that we may ultimately try and turn into an ontology.

Instance Attribute Summary collapse

Attributes included from Housekeeping::Users

#by

Method Summary

Methods included from Shared::IsData

#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar

Methods included from Shared::HasPapertrail

#attribute_updated, #attribute_updater

Methods included from Shared::Tags

#reject_tags, #tag_with, #tagged?, #tagged_with?

Methods included from Housekeeping::Users

#set_created_by_id, #set_updated_by_id

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Attribute Details

#definitionString

Returns a definition describing the preparation.

Returns:

  • (String)

    a definition describing the preparation



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/models/preparation_type.rb', line 12

class PreparationType < ApplicationRecord
  include Housekeeping::Users
  include Housekeeping::Timestamps
  include Shared::Tags
  include Shared::SharedAcrossProjects
  include Shared::HasPapertrail
  include Shared::IsData

  has_many :collection_objects, dependent: :restrict_with_error, inverse_of: :preparation_type
  validates_presence_of :name, :definition

  validates_uniqueness_of :name
  validates_uniqueness_of :definition

end

#nameString

Returns the name of the preparation.

Returns:

  • (String)

    the name of the preparation



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/models/preparation_type.rb', line 12

class PreparationType < ApplicationRecord
  include Housekeeping::Users
  include Housekeeping::Timestamps
  include Shared::Tags
  include Shared::SharedAcrossProjects
  include Shared::HasPapertrail
  include Shared::IsData

  has_many :collection_objects, dependent: :restrict_with_error, inverse_of: :preparation_type
  validates_presence_of :name, :definition

  validates_uniqueness_of :name
  validates_uniqueness_of :definition

end