Sha256: 7c52ba01aa6b5a1abce9e5dccc4bc781095cd3350890746512a064cee83bdb63

Contents?: true

Size: 788 Bytes

Versions: 1

Compression:

Stored size: 788 Bytes

Contents

class Person < ActiveRecord::Base
	usesguid

	has_many :elts

	has_many :choices, :dependent => :destroy
	has_many :issues, :through => :choices, :source => :elt
	has_many :subscriptions, :dependent => :destroy
	has_many :subscribed_elts, :through => :subscriptions, :source => :elt
	has_many :person_mails, :dependent => :destroy
	has_many :mails, :through => :person_mails, :source => :mail

	validates_presence_of :name, :on => :create
	validates_length_of :name, :within => 3..80, :on => :create
  validates_uniqueness_of :name, :on => :create
  validates_uniqueness_of :email, :on => :create,
		:if => Proc.new { |p| p.email and p.email.length > 0 }

	# Convenience method, because User is as it was from the salted login plugin
	def user
		return User.find_by_login(name)
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
parlement-0.10 app/models/person.rb