Skip to content

Commit

Permalink
Update chapters 05 and 06 (#81)
Browse files Browse the repository at this point in the history
* Update chapter03-presenting-users.adoc

Fix: Use correct password_digest field in test code.
Fix: Typo.

* Update chapter03-presenting-users.adoc

Fix: Commit message for update action.

* Fix casing in create Order model statement

* Remove duplicated question from answers.

* Expose order model, not user model.
  • Loading branch information
ForerunnerG34 committed Jun 14, 2021
1 parent 137a234 commit 9feff0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions rails6/en/chapter06-improve-json.adoc
Expand Up @@ -1099,11 +1099,6 @@ Which following snippet is a valid JSON:API response?:: With product's user into
----
+

What is the purpose of `Hash#dig` method?::
. Get a nested element safer.
. Get a nested element and load Active Record relations if needed.
. Add a nested element safer.

What is the purpose of `Hash#dig` method?:: Get a nested element safer. It is a Ruby method allowing you to retrieve elements in a nested `Hash` by avoiding errors if an element is not present.

How do you include user information in a JSON:API output of a product?::
Expand Down
4 changes: 2 additions & 2 deletions rails6/en/chapter07-placing-orders.adoc
Expand Up @@ -31,7 +31,7 @@ Let’s start by creating the older model with a special form:

[source,bash]
----
$ rails generate model order user:belongs_to total:decimal
$ rails generate model Order user:belongs_to total:decimal
----

The command above will generate the order model, but I’m taking advantage of the `belongs_to` column type to create the corresponding foreign key for the order to belong to a user. It also adds the `belongs_to` association into the order model. Let’s migrate the database.
Expand Down Expand Up @@ -166,7 +166,7 @@ $ git add . && git commit -m "Associates products and orders with a placements m
----


== Expose the user model
== Expose the order model

It is now time to prepare the order controller to expose the right orders. If you remember the previous chapters where https://github.com/jsonapi-serializer/jsonapi-serializer[jsonapi-serializer] was used, you should remember that it was straightforward.

Expand Down

0 comments on commit 9feff0f

Please sign in to comment.