Merge pull request #50881 from D-system/doc-no-extension-in-filename-render

Update caching_with_rails.md regarding extension in filename [ci skip]
This commit is contained in:
Petrik de Heus 2024-01-30 10:17:39 +01:00 committed by GitHub
commit 1cb5b8d5a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -191,10 +191,10 @@ render(partial: 'hotels/hotel', collection: @hotels, cached: true)
Will load a file named `hotels/hotel.erb`. Will load a file named `hotels/hotel.erb`.
Another option is to include the full filename of the partial to render. Another option is to include the `formats` attribute to the partial to render.
```ruby ```ruby
render(partial: 'hotels/hotel.html.erb', collection: @hotels, cached: true) render(partial: 'hotels/hotel', collection: @hotels, formats: :html, cached: true)
``` ```
Will load a file named `hotels/hotel.html.erb` in any file MIME type, for example you could include this partial in a JavaScript file. Will load a file named `hotels/hotel.html.erb` in any file MIME type, for example you could include this partial in a JavaScript file.