From 960041819426ad8863879da2f50b32f6a5a5e6be Mon Sep 17 00:00:00 2001 From: rbarazi Date: Tue, 13 Apr 2010 12:15:57 -0400 Subject: [PATCH] Adding admin field --- README | 2 +- db/migrate/20100413161535_add_admin_to_users.rb | 9 +++++++++ db/schema.rb | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20100413161535_add_admin_to_users.rb diff --git a/README b/README index 6a6d3f9..259cfa0 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ - Generating User model: 'rails generate devise User' - Add admin boolean field - + - rails generate migration AddAdminToUsers admin:boolean - URLS - http://localhost:3000/users/registration/sign_up diff --git a/db/migrate/20100413161535_add_admin_to_users.rb b/db/migrate/20100413161535_add_admin_to_users.rb new file mode 100644 index 0000000..0c1509d --- /dev/null +++ b/db/migrate/20100413161535_add_admin_to_users.rb @@ -0,0 +1,9 @@ +class AddAdminToUsers < ActiveRecord::Migration + def self.up + add_column :users, :admin, :boolean + end + + def self.down + remove_column :users, :admin + end +end diff --git a/db/schema.rb b/db/schema.rb index e9e170e..759d09f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20100411220700) do +ActiveRecord::Schema.define(:version => 20100413161535) do create_table "order_items", :force => true do |t| t.integer "order_id" @@ -59,6 +59,7 @@ t.string "last_sign_in_ip" t.datetime "created_at" t.datetime "updated_at" + t.boolean "admin" end add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true