adding a normal role to people being created

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@127 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2008-02-03 20:21:21 +00:00
parent 11e3356f55
commit fe1e417bac
1 changed files with 9 additions and 0 deletions

View File

@ -21,6 +21,8 @@ class People < ActiveRecord::Base
validates_length_of :password, :minimum => 8, :if => :password_required?, validates_length_of :password, :minimum => 8, :if => :password_required?,
:message => 'must be at least 8 characters in length' :message => 'must be at least 8 characters in length'
before_create :set_user_role
## ##
# Used to quickly determine if the particular id of another Person is a # Used to quickly determine if the particular id of another Person is a
# Friend of this instance. # Friend of this instance.
@ -39,6 +41,13 @@ class People < ActiveRecord::Base
protected protected
##
# Forces the People Role to be a tame default unless otherwise overridden.
#
def set_user_role
self.role = Role.normal_role if self.role.nil?
end
## ##
# Determines if the password is needed. # Determines if the password is needed.
# #