Sha256: 0015549216a1ed848bb5e57b5ee871d5590c7777de6745af580aef5aed28c29d

Contents?: true

Size: 435 Bytes

Versions: 20

Compression:

Stored size: 435 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 name
    user.name
  end

  def email
    user.email
  end

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
saucy-0.7.0 app/models/membership.rb
saucy-0.6.1 app/models/membership.rb
saucy-0.6.0 app/models/membership.rb
saucy-0.5.5 app/models/membership.rb
saucy-0.5.4 app/models/membership.rb
saucy-0.5.3 app/models/membership.rb
saucy-0.5.2 app/models/membership.rb
saucy-0.5.1 app/models/membership.rb
saucy-0.5.0 app/models/membership.rb
saucy-0.4.10 app/models/membership.rb
saucy-0.4.9 app/models/membership.rb
saucy-0.4.8 app/models/membership.rb
saucy-0.4.7 app/models/membership.rb
saucy-0.4.6 app/models/membership.rb
saucy-0.4.5 app/models/membership.rb
saucy-0.4.4 app/models/membership.rb
saucy-0.4.3 app/models/membership.rb
saucy-0.4.2 app/models/membership.rb
saucy-0.4.1 app/models/membership.rb
saucy-0.3.4.1 app/models/membership.rb