diff --git a/rails6/en/chapter06-improve-json.adoc b/rails6/en/chapter06-improve-json.adoc index b4ea64d..5c4ffaa 100644 --- a/rails6/en/chapter06-improve-json.adoc +++ b/rails6/en/chapter06-improve-json.adoc @@ -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?:: diff --git a/rails6/en/chapter07-placing-orders.adoc b/rails6/en/chapter07-placing-orders.adoc index 3b87dd5..c4f3384 100644 --- a/rails6/en/chapter07-placing-orders.adoc +++ b/rails6/en/chapter07-placing-orders.adoc @@ -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. @@ -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.