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.6.10 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.6.9 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.6.8 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.6.7 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.6.6 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.6.5 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.6.4 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.6.3 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.6.2 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.6.1 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.6.0 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.5.2 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.5.1 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.5.0 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.4.11 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.4.10 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.4.9 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.4.8 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.4.7 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.4.6 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb