Sha256: 6e75f52d11a49707bf807bb45839661b7e60627146ce2b720fe2950376805613

Contents?: true

Size: 485 Bytes

Versions: 49

Compression:

Stored size: 485 Bytes

Contents

class Membership < ActiveRecord::Base
  belongs_to :user
  belongs_to :account
  has_many :permissions, :dependent => :destroy
  has_many :projects, :through => :permissions

  validates_presence_of :user_id
  validates_presence_of :account_id
  validates_uniqueness_of :user_id, :scope => :account_id

  def self.admin
    where(:admin => true)
  end

  def name
    user.name
  end

  def email
    user.email
  end

  def self.by_name
    joins(:user).order('users.name')
  end
end

Version data entries

49 entries across 49 versions & 2 rubygems

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