diff options
author | 2010-08-13 17:10:49 +0200 | |
---|---|---|
committer | 2010-08-16 13:35:14 +0200 | |
commit | 51a670e32ba30dc46bf74da98cbdb8594f71718d (patch) | |
tree | b116343fe5a9255f1f481e40efdb814daf293b2d | |
parent | Simplify Question permissions (diff) | |
download | recruiting-webapp-51a670e32ba30dc46bf74da98cbdb8594f71718d.tar.gz recruiting-webapp-51a670e32ba30dc46bf74da98cbdb8594f71718d.tar.bz2 recruiting-webapp-51a670e32ba30dc46bf74da98cbdb8594f71718d.zip |
Move Role where it belongs to app/rich_types
-rw-r--r-- | app/models/guest.rb | 2 | ||||
-rw-r--r-- | app/models/role.rb | 1 | ||||
-rw-r--r-- | app/models/user.rb | 6 | ||||
-rw-r--r-- | app/rich_types/role.rb | 3 | ||||
-rw-r--r-- | features/step_definitions/users_steps.rb | 2 |
5 files changed, 8 insertions, 6 deletions
diff --git a/app/models/guest.rb b/app/models/guest.rb index 4348c85..2c01803 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -10,7 +10,7 @@ class Guest < Hobo::Guest def nick; nil; end def project_lead; false; end def questions_to_approve; []; end - def role; Role.new(:guest); end + def role; RichTypes::Role.new(:guest); end def token; nil; end def valid?; true; end def save!; true; end diff --git a/app/models/role.rb b/app/models/role.rb deleted file mode 100644 index 4e122d9..0000000 --- a/app/models/role.rb +++ /dev/null @@ -1 +0,0 @@ -Role = HoboFields::EnumString.for(:recruit, :mentor, :recruiter) diff --git a/app/models/user.rb b/app/models/user.rb index 078c37c..828840f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,7 +12,7 @@ class User < ActiveRecord::Base name :string, :required, :unique email_address :email_address, :login => true administrator :boolean, :default => false - role Role, :default => 'recruit' + role RichTypes::Role, :default => 'recruit' nick :string openid :string contributions HoboFields::MarkdownString @@ -215,8 +215,8 @@ class User < ActiveRecord::Base # and make sure change to role wasn't changed or was promotion of recruit # to mentor or demotion of mentor to recruit return true unless role_changed? - return true if role.is_mentor? && Role.new(role_was).is_recruit? - return true if role.is_recruit? && Role.new(role_was).is_mentor? + return true if role.is_mentor? && RichTypes::Role.new(role_was).is_recruit? + return true if role.is_recruit? && RichTypes::Role.new(role_was).is_mentor? false end diff --git a/app/rich_types/role.rb b/app/rich_types/role.rb new file mode 100644 index 0000000..c69627d --- /dev/null +++ b/app/rich_types/role.rb @@ -0,0 +1,3 @@ +module RichTypes + Role = HoboFields::EnumString.for(:recruit, :mentor, :recruiter) +end diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb index 4493402..932e538 100644 --- a/features/step_definitions/users_steps.rb +++ b/features/step_definitions/users_steps.rb @@ -8,7 +8,7 @@ end Given /^(?:|a )user "([^\"]*)" who is "([^\"]*)"$/ do |user, role| Given "user \"#{user}\"" - @user.role = Role.new(role) + @user.role = RichTypes::Role.new(role) @user.save! end |