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.17 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.16 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.15 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.14 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.13 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.12 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.11 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-1.0.10 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-templates-1.0.5 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-templates-1.0.4 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-templates-1.0.3 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-templates-1.0.2 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-templates-1.0.1 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb
bullet_train-super_scaffolding-templates-1.0.0 app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb