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.12.2 app/models/membership.rb
saucy-0.12.1 app/models/membership.rb
saucy-0.12.0 app/models/membership.rb
saucy-0.11.5 app/models/membership.rb
saucy-0.11.3 app/models/membership.rb
saucy-0.11.2 app/models/membership.rb
saucy-0.10.7 app/models/membership.rb
saucy-0.10.6 app/models/membership.rb
saasy-0.0.2.alpha3 app/models/membership.rb
saasy-0.0.2.alpha2 app/models/membership.rb
saasy-0.0.2.alpha1 app/models/membership.rb
saucy-0.10.5 app/models/membership.rb
saucy-0.10.4 app/models/membership.rb
saucy-0.10.3 app/models/membership.rb
saucy-0.10.2 app/models/membership.rb
saucy-0.10.1 app/models/membership.rb
saucy-0.10.0 app/models/membership.rb
saucy-0.9.1 app/models/membership.rb
saucy-0.9.0 app/models/membership.rb
saucy-0.8.5 app/models/membership.rb