From fe1e417bacc66e7431b5e1f63f3155820b761871 Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 3 Feb 2008 20:21:21 +0000 Subject: [PATCH] adding a normal role to people being created git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@127 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7 --- app/models/people.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/models/people.rb b/app/models/people.rb index e87e940..1cbe18d 100644 --- a/app/models/people.rb +++ b/app/models/people.rb @@ -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. #