aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei Xie <xieconnect@gmail.com>2010-07-26 08:30:01 +0800
committerHans de Graaff <hans@degraaff.org>2010-07-28 20:01:49 +0200
commitb0393e159bd6893dc8468f8af1f19462a39f2ac9 (patch)
tree67ee255befe7df927e19e797f3b1fb5203280093
parentAdd support for labels in field-list (diff)
downloadcouncil-webapp-b0393e159bd6893dc8468f8af1f19462a39f2ac9.tar.gz
council-webapp-b0393e159bd6893dc8468f8af1f19462a39f2ac9.tar.bz2
council-webapp-b0393e159bd6893dc8468f8af1f19462a39f2ac9.zip
Rename User Role guest to user
-rw-r--r--app/models/role.rb2
-rw-r--r--app/models/user.rb15
-rw-r--r--db/migrate/20100606021229_add_role_to_users.rb2
3 files changed, 9 insertions, 10 deletions
diff --git a/app/models/role.rb b/app/models/role.rb
index c0f7911..1a382a3 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -1 +1 @@
-Role = HoboFields::EnumString.for(:council_member, :admin, :developer, :guest)
+Role = HoboFields::EnumString.for(:council_member, :admin, :developer, :user)
diff --git a/app/models/user.rb b/app/models/user.rb
index 2ab1a17..90c335e 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -5,7 +5,7 @@ class User < ActiveRecord::Base
fields do
name :string, :required, :unique
email_address :email_address, :login => true
- role Role, :default => 'guest', :limit => 20
+ role Role, :default => 'user', :limit => 20
timestamps
end
@@ -15,13 +15,12 @@ class User < ActiveRecord::Base
# This gives admin rights to the first sign-up.
# Just remove it if you don't want that
before_create do |user|
- if !Rails.env.test? && count == 0
- user.role = :admin
- else
- user.role = :guest
- end
- end
-
+ if !Rails.env.test? && count == 0
+ user.role = :admin
+ else
+ user.role = :user
+ end
+ end
# --- Signup lifecycle --- #
diff --git a/db/migrate/20100606021229_add_role_to_users.rb b/db/migrate/20100606021229_add_role_to_users.rb
index 8466952..013edf1 100644
--- a/db/migrate/20100606021229_add_role_to_users.rb
+++ b/db/migrate/20100606021229_add_role_to_users.rb
@@ -1,6 +1,6 @@
class AddRoleToUsers < ActiveRecord::Migration
def self.up
- add_column :users, :role, :string, :limit => 20, :default => 'guest'
+ add_column :users, :role, :string, :limit => 20, :default => 'user'
remove_column :users, :administrator
end