Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions rails6/en/chapter06-improve-json.adoc
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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