Sha256: 2380231b702983d574421019cb47539b8523ec166cb8affce66e255cbae52f05

Contents?: true

Size: 1.37 KB

Versions: 49

Compression:

Stored size: 1.37 KB

Contents

class Scaffolding::AbsolutelyAbstract::CreativeConcept < ApplicationRecord
  # 🚅 add concerns above.

  belongs_to :team
  # 🚅 add belongs_to associations above.

  # TODO: We shouldn't have to explicitly set the order here, so we need to find out why these records
  # are being returned in descending order when calling @creative_concept.completely_concrete_tangible_things.
  has_many :completely_concrete_tangible_things, -> { order(:id) }, class_name: "Scaffolding::CompletelyConcrete::TangibleThing", foreign_key: :absolutely_abstract_creative_concept_id, dependent: :destroy
  has_many :collaborators, class_name: "Scaffolding::AbsolutelyAbstract::CreativeConcepts::Collaborator", dependent: :destroy, foreign_key: :creative_concept_id
  has_many :memberships, through: :collaborators
  # 🚅 add has_many associations above.

  # 🚅 add oauth providers above.

  # 🚅 add has_one associations above.

  # 🚅 add scopes above.

  validates :name, presence: true
  # 🚅 add validations above.

  # 🚅 add callbacks above.

  # 🚅 add delegations above.

  def admins
    collaborators.admins.map(&:membership)
  end

  def editors
    collaborators.editors.map(&:membership)
  end

  def viewers
    collaborators.viewers.map(&:membership)
  end

  def all_collaborators
    team.admins.or(Membership.where(id: memberships.pluck(:id)))
  end

  # 🚅 add methods above.
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
bullet_train-super_scaffolding-1.6.10 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.6.9 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.6.8 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.6.7 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.6.6 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.6.5 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.6.4 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.6.3 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.6.2 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.6.1 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.6.0 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.5.2 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.5.1 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.5.0 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.4.11 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.4.10 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.4.9 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.4.8 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.4.7 app/models/scaffolding/absolutely_abstract/creative_concept.rb
bullet_train-super_scaffolding-1.4.6 app/models/scaffolding/absolutely_abstract/creative_concept.rb