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.2.19 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.18 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.17 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.16 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.15 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.14 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.13 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.12 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.11 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.10 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.9 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.8 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.7 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.6 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.5 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.4 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.3 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.2 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.1 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.2.0 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb