Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 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 Expand Up @@ -614,7 +614,7 @@ We do a commit Since everything works:

[source,bash]
----
$ git commit -am "Adds update action the users controller"
$ git commit -am "Adds update action to the users controller"
----

=== Delete the user
Expand Down