Class: ProjectOrganization

Inherits:
ApplicationRecord show all
Includes:
Housekeeping, Shared::IsData
Defined in:
app/models/project_organization.rb

Overview

A ProjectOrganization links Organizations to a Project, for example the institutions that curate, host, or fund the data in that Project.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Shared::IsData

#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_in_use?, #similar

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Attribute Details

#organization_idInteger

Returns the organization.

Returns:

  • (Integer)

    the organization



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/models/project_organization.rb', line 12

class ProjectOrganization < ApplicationRecord
  include Housekeeping
  include Shared::IsData

  belongs_to :organization, inverse_of: :project_organizations

  validates :organization, presence: true

  validates_uniqueness_of :organization_id, scope: [:project_id]

  # @return [Scope]
  #   the Depictions of the Organization in this project
  def depictions
    Depiction.where(
      depiction_object: organization,
      project_id:
    )
  end

end

#project_idInteger

Returns the project.

Returns:

  • (Integer)

    the project



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/models/project_organization.rb', line 12

class ProjectOrganization < ApplicationRecord
  include Housekeeping
  include Shared::IsData

  belongs_to :organization, inverse_of: :project_organizations

  validates :organization, presence: true

  validates_uniqueness_of :organization_id, scope: [:project_id]

  # @return [Scope]
  #   the Depictions of the Organization in this project
  def depictions
    Depiction.where(
      depiction_object: organization,
      project_id:
    )
  end

end

Instance Method Details

#depictionsScope

Returns the Depictions of the Organization in this project.

Returns:

  • (Scope)

    the Depictions of the Organization in this project



24
25
26
27
28
29
# File 'app/models/project_organization.rb', line 24

def depictions
  Depiction.where(
    depiction_object: organization,
    project_id:
  )
end