Skip to content

Commit

Permalink
Update custom layout documentation for version 1.4.0 (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
cice authored Jun 20, 2023
1 parent 865377e commit 37a7cd0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ When the user will click on the `Edit this todo` link, as direct response to thi
### A note on custom layouts

In order to render turbo frame requests without the application layout, Turbo registers a custom [layout method](https://api.rubyonrails.org/classes/ActionView/Layouts/ClassMethods.html#method-i-layout).
If your application uses custom layout resolution, you have to make sure to return `false` for turbo frame requests:
If your application uses custom layout resolution, you have to make sure to return `""turbo_rails/frame"` (or `false` for TurboRails < 1.4.0) for turbo frame requests:

```ruby
layout :custom_layout

def custom_layout
return false if turbo_frame_request?
return "turbo_rails/frame" if turbo_frame_request?

# ... your custom layout logic
```
Expand All @@ -81,7 +81,7 @@ you **have** to change it to a layout method in order to conditionally return `f
layout :custom_layout

def custom_layout
return false if turbo_frame_request?
return "turbo_rails/frame" if turbo_frame_request?

"some_static_layout"
```
Expand Down

0 comments on commit 37a7cd0

Please sign in to comment.