mirror of https://github.com/rails/rails
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:
commit
1cb5b8d5a9
|
@ -191,10 +191,10 @@ render(partial: 'hotels/hotel', collection: @hotels, cached: true)
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue