Skip to content

Commit 5762ac1

Browse files
authored
Replace link with permalink and improve MIME type registration example
1 parent 7da99f7 commit 5762ac1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

guides/source/action_controller_overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,10 +1073,10 @@ class ClientsController < ApplicationController
10731073
end
10741074
```
10751075

1076-
This example works because [Rails already registers the `"application/pdf"` MIME type](https://github.com/rails/rails/blob/main/actionpack/lib/action_dispatch/http/mime_types.rb) at startup (alongside other common types). If you need additional MIME types, call [`Mime::Type.register`](https://api.rubyonrails.org/classes/Mime/Type.html#method-c-register) in the file `config/initializers/mime_types.rb`. For example:
1076+
This example works because [Rails already registers the `"application/pdf"` MIME type](https://github.com/rails/rails/blob/b26a9fd2551a2e65e8deef10f4b5ca6b99d666fb/actionpack/lib/action_dispatch/http/mime_types.rb) at startup (alongside other common types). If you need additional MIME types, call [`Mime::Type.register`](https://api.rubyonrails.org/classes/Mime/Type.html#method-c-register) in the file `config/initializers/mime_types.rb`. For example, this is how you would register the Rich Text Format (RTF):
10771077

10781078
```ruby
1079-
Mime::Type.register(<mime_type>, <symbol>)
1079+
Mime::Type.register("application/rtf", :rtf)
10801080
```
10811081

10821082
NOTE: Configuration files are not reloaded on each request, so you have to restart the server for their changes to take effect.

0 commit comments

Comments
 (0)