WIP adding user roles view; adding end datetime to user roles

This commit is contained in:
John N. Milner
2013-04-18 22:16:13 -04:00
parent ac9e5718c7
commit a3fcdec10c
10 changed files with 62 additions and 17 deletions
@@ -0,0 +1,7 @@
class AddEndsToUserRoles < ActiveRecord::Migration
def change
add_column(:user_roles, :ends, :timestamp)
add_column(:user_roles, :user_id, :integer)
remove_column(:users, :role_id)
end
end
+3 -1
View File
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130405012238) do
ActiveRecord::Schema.define(:version => 20130419010051) do
create_table "bike_actions", :force => true do |t|
t.string "action", :limit => 128, :null => false
@@ -152,6 +152,8 @@ ActiveRecord::Schema.define(:version => 20130405012238) do
t.string "role"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "ends"
t.integer "user_id"
end
create_table "users", :force => true do |t|
-9
View File
@@ -1,9 +0,0 @@
user:
id: 1
role: user
staff:
id: 2
role: staff
admin:
id: 3
role: admin
+2 -1
View File
@@ -21,10 +21,11 @@ end
if Rails.env.development?
#create default admin user
if User.all.empty?
if UserRole.all.empty? and User.all.empty?
FactoryGirl.create(:user)
FactoryGirl.create(:staff)
FactoryGirl.create(:admin)
FactoryGirl.create(:bike_admin)
FactoryGirl.create(:user_profile)
end