Sha256: 26ed25a35887aad6a56d4cd25c45a256b7e083fbc0d1ff726066e5a1a513febd

Contents?: true

Size: 415 Bytes

Versions: 44

Compression:

Stored size: 415 Bytes

Contents

class Permission < ActiveRecord::Base
  belongs_to :membership
  belongs_to :project
  belongs_to :user

  before_validation :assign_user_id_from_membership

  validates_uniqueness_of :membership_id, :scope => :project_id

  def user=(ignored)
    raise NotImplementedError, "Use Permission#membership= instead"
  end

  private

  def assign_user_id_from_membership
    self.user_id = membership.user_id
  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
saucy-0.16.1 app/models/permission.rb
saucy-0.16.0 app/models/permission.rb
saucy-0.15.2 app/models/permission.rb
saucy-0.15.1 app/models/permission.rb
saucy-0.15.0 app/models/permission.rb
saucy-0.14.5 app/models/permission.rb
saucy-0.14.3 app/models/permission.rb
saucy-0.10.10 app/models/permission.rb
saucy-0.14.2 app/models/permission.rb
saucy-0.14.1 app/models/permission.rb
saucy-0.14.0 app/models/permission.rb
saucy-0.13.3 app/models/permission.rb
saucy-0.13.2 app/models/permission.rb
saucy-0.10.9 app/models/permission.rb
saucy-0.10.8 app/models/permission.rb
saucy-0.13.1 app/models/permission.rb
saucy-0.13.0 app/models/permission.rb
saucy-0.12.5 app/models/permission.rb
saucy-0.12.4 app/models/permission.rb
saucy-0.12.3 app/models/permission.rb