Sha256: a873405d7d33ef0c051d41e1afb18d26346cfd33277a8f951585a945e8426a75

Contents?: true

Size: 1001 Bytes

Versions: 134

Compression:

Stored size: 1001 Bytes

Contents

class Scaffolding::AbsolutelyAbstract::CreativeConcepts::Collaborator < ApplicationRecord
  include Roles::Support
  # 🚅 add concerns above.

  belongs_to :creative_concept
  belongs_to :membership
  # 🚅 add belongs_to associations above.

  # 🚅 add has_many associations above.

  has_one :team, through: :creative_concept
  has_one :user, through: :membership
  # 🚅 add has_one associations above.

  # 🚅 add scopes above.

  validates :membership_id, presence: true
  validate :validate_membership
  # 🚅 add validations above.

  # 🚅 add callbacks above.

  # 🚅 add delegations above.

  def valid_memberships
    team.memberships.current_and_invited
  end

  def validate_membership
    if membership_id.present?
      # don't allow users to assign the ids of other teams' or users' resources to this attribute.
      unless valid_memberships.ids.include?(membership_id)
        errors.add(:membership_id, :invalid)
      end
    end
  end

  # 🚅 add methods above.
end

Version data entries

134 entries across 134 versions & 2 rubygems

Version Path
bullet_train-super_scaffolding-1.0.39 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.38 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.37 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.36 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.35 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.34 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.33 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.32 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.31 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.30 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.29 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.28 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.27 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.26 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.25 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.24 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.23 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.22 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.21 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.20 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb