Skip to content

Commit

Permalink
Update chapter03-presenting-users.adoc (#79)
Browse files Browse the repository at this point in the history
Fix: Use correct password_digest field in test code.
Fix: Typo.
  • Loading branch information
ForerunnerG34 authored May 28, 2021
1 parent 6ba31a7 commit 5d358a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rails6/en/chapter03-presenting-users.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ end
----
# ...
test 'user with invalid email should be invalid' do
user = User.new(email: 'test', password: 'test')
user = User.new(email: 'test', password_digest: 'test')
assert_not user.valid?
end
----
Expand Down Expand Up @@ -249,7 +249,7 @@ gem "bcrypt", "~> 3.1"

NOTE: Version 3.1 of bcrypt is the current version at the time of writing. It may therefore vary for your case.

Active Record offers us a method https://github.com/rails/rails/blob/6-0-stable/activemodel/lib/active_model/secure_password.rb#L61[`ActiveModel::SecurePassword::has_secure_password`] that will interface with Bcrypt and hack the password for us very easily.
Active Record offers us a method https://github.com/rails/rails/blob/6-0-stable/activemodel/lib/active_model/secure_password.rb#L61[`ActiveModel::SecurePassword::has_secure_password`] that will interface with Bcrypt and hash the password for us very easily.

[source,ruby]
.app/models/user.rb
Expand Down

0 comments on commit 5d358a4

Please sign in to comment.