Skip to content
This repository was archived by the owner on Sep 24, 2019. It is now read-only.

Commit 1827161

Browse files
committed
add password
1 parent 00b1504 commit 1827161

File tree

5 files changed

+9
-2
lines changed

5 files changed

+9
-2
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ gem 'graphiql-rails', '~> 1.4.1'
1818

1919
gem 'uglifier'
2020

21+
gem 'bcrypt'
22+
2123
group :development, :test do
2224
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
2325
gem 'byebug', platform: :mri

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ GEM
3939
minitest (~> 5.1)
4040
tzinfo (~> 1.1)
4141
arel (7.1.4)
42+
bcrypt (3.1.11)
4243
builder (3.2.3)
4344
byebug (9.0.6)
4445
concurrent-ruby (1.0.4)
@@ -134,6 +135,7 @@ PLATFORMS
134135
ruby
135136

136137
DEPENDENCIES
138+
bcrypt
137139
byebug
138140
graphiql-rails (~> 1.4.1)
139141
graphql (~> 1.4.3)

app/models/user.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class User < ApplicationRecord
2+
has_secure_password
23
has_many :ratings
34
has_many :rated_films, through: :ratings, source: :film
45
end

db/migrate/20170212195638_create_ratings.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ def change
33
create_table :users do |t|
44
t.string :name
55
t.string :email
6+
t.string :password_digest
67
t.timestamps
78
end
89

db/schema.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@
150150
create_table "users", force: :cascade do |t|
151151
t.string "name"
152152
t.string "email"
153-
t.datetime "created_at", null: false
154-
t.datetime "updated_at", null: false
153+
t.string "password_digest"
154+
t.datetime "created_at", null: false
155+
t.datetime "updated_at", null: false
155156
end
156157

157158
create_table "vehicles", force: :cascade do |t|

0 commit comments

Comments
 (0)