From ee7a1ab8ed17d697d9972612535da414acfa79ca Mon Sep 17 00:00:00 2001 From: Sean Collins Date: Wed, 24 Jul 2024 12:26:47 -0600 Subject: [PATCH] Add note about first format being default --- content/v2.0/actions/formats-and-mime-types.md | 3 +++ content/v2.1/actions/formats-and-mime-types.md | 3 +++ content/v2.2/actions/formats-and-mime-types.md | 3 +++ 3 files changed, 9 insertions(+) diff --git a/content/v2.0/actions/formats-and-mime-types.md b/content/v2.0/actions/formats-and-mime-types.md index 51906948..787a1edd 100644 --- a/content/v2.0/actions/formats-and-mime-types.md +++ b/content/v2.0/actions/formats-and-mime-types.md @@ -188,6 +188,7 @@ If you need your actions to work with additional MIME types, you can configure t module Bookshelf class App < Hanami::App + # config.actions.formats.add :html config.actions.formats.add :custom, "application/custom" end end @@ -195,6 +196,8 @@ end This will add the `:custom` format for the `"application/custom"` MIME type and also configure your actions to use this format. +The **first format added will be the default format**, so you likely want to add `:html` or `:json` before any custom formats. + You can also configure a format to map to multiple MIME types: ```ruby diff --git a/content/v2.1/actions/formats-and-mime-types.md b/content/v2.1/actions/formats-and-mime-types.md index 51906948..787a1edd 100644 --- a/content/v2.1/actions/formats-and-mime-types.md +++ b/content/v2.1/actions/formats-and-mime-types.md @@ -188,6 +188,7 @@ If you need your actions to work with additional MIME types, you can configure t module Bookshelf class App < Hanami::App + # config.actions.formats.add :html config.actions.formats.add :custom, "application/custom" end end @@ -195,6 +196,8 @@ end This will add the `:custom` format for the `"application/custom"` MIME type and also configure your actions to use this format. +The **first format added will be the default format**, so you likely want to add `:html` or `:json` before any custom formats. + You can also configure a format to map to multiple MIME types: ```ruby diff --git a/content/v2.2/actions/formats-and-mime-types.md b/content/v2.2/actions/formats-and-mime-types.md index 51906948..787a1edd 100644 --- a/content/v2.2/actions/formats-and-mime-types.md +++ b/content/v2.2/actions/formats-and-mime-types.md @@ -188,6 +188,7 @@ If you need your actions to work with additional MIME types, you can configure t module Bookshelf class App < Hanami::App + # config.actions.formats.add :html config.actions.formats.add :custom, "application/custom" end end @@ -195,6 +196,8 @@ end This will add the `:custom` format for the `"application/custom"` MIME type and also configure your actions to use this format. +The **first format added will be the default format**, so you likely want to add `:html` or `:json` before any custom formats. + You can also configure a format to map to multiple MIME types: ```ruby