adding a normal role to people being created
git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@127 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7master
parent
11e3356f55
commit
fe1e417bac
|
@ -21,6 +21,8 @@ class People < ActiveRecord::Base
|
|||
validates_length_of :password, :minimum => 8, :if => :password_required?,
|
||||
: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
|
||||
# Friend of this instance.
|
||||
|
@ -39,6 +41,13 @@ class People < ActiveRecord::Base
|
|||
|
||||
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.
|
||||
#
|
||||
|
|
Reference in New Issue