Sha256: 9dc7bdfa209468eae65fba0ad4696298a48c3d7e8177dbe4b748eb175f9f8b13

Contents?: true

Size: 363 Bytes

Versions: 2

Compression:

Stored size: 363 Bytes

Contents

class ProjectMembership < ActiveRecord::Base
  attr_accessible :user, :project, :user_id, :project_id

  belongs_to :user
  belongs_to :project

  validate :ensure_account_member

  private

  def ensure_account_member
    unless user.member_of?(project.account)
      errors.add(:base, "This user is not a member of #{project.name}'s account")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
saucy-0.1.2 app/models/project_membership.rb
saucy-0.1.1 app/models/project_membership.rb