Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added User table and controller

  • Loading branch information...
commit 1bce34b7ab343c4b12ca00deb72050d134761d81 1 parent e273216
@florida authored
View
4 app/controllers/users_controller.rb
@@ -0,0 +1,4 @@
+class UsersController < ApplicationController
+ def new
+ end
+end
View
9 app/models/user.rb
@@ -1,10 +1,3 @@
class User < ActiveRecord::Base
- authenticates_with_sorcery!
- attr_accessible :email, :password, :password_confirmation
-
- validates_confirmation_of :password
- validates_presence_of :password, :on => :create
- validates_presence_of :email
- validates_uniqueness_of :email
-
+ attr_accessible :email, :password_hash, :password_salt
end
View
2  app/views/users/new.html.erb
@@ -0,0 +1,2 @@
+<h1>Users#new</h1>
+<p>Find me in app/views/users/new.html.erb</p>
View
2  config/routes.rb
@@ -1,4 +1,6 @@
Elmorfstore::Application.routes.draw do
+ get "users/new"
+
match 'store' => 'store#index', :as => 'store', :via => :get
match 'shoppingcart' => 'store#show_cart', :as => 'shoppingcart', :via => :get
match 'add_to_cart/:id' => 'store#add_to_cart', :as => 'add_to_cart'
View
9 db/migrate/20121120235219_drop_users_table.rb
@@ -0,0 +1,9 @@
+class DropUsersTable < ActiveRecord::Migration
+ def up
+ drop_table :users
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
View
11 db/migrate/20121120235329_create_users.rb
@@ -0,0 +1,11 @@
+class CreateUsers < ActiveRecord::Migration
+ def change
+ create_table :users do |t|
+ t.string :email
+ t.string :password_hash
+ t.string :password_salt
+
+ t.timestamps
+ end
+ end
+end
View
11 db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20121120043132) do
+ActiveRecord::Schema.define(:version => 20121120235329) do
create_table "lineitems", :force => true do |t|
t.integer "product_id"
@@ -57,12 +57,11 @@
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
create_table "users", :force => true do |t|
- t.string "username", :null => false
t.string "email"
- t.string "crypted_password"
- t.string "salt"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.string "password_hash"
+ t.string "password_salt"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
end
View
18 test/fixtures/users.yml
@@ -1,11 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
-# This model initially had no columns defined. If you add columns to the
-# model remove the '{}' from the fixture names and add the columns immediately
-# below each fixture, per the syntax in the comments below
-#
-one: {}
-# column: value
-#
-two: {}
-# column: value
+one:
+ email: MyString
+ password_hash: MyString
+ password_salt: MyString
+
+two:
+ email: MyString
+ password_hash: MyString
+ password_salt: MyString
Please sign in to comment.
Something went wrong with that request. Please try again.