-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stream Tag Builder: Support
:renderable
arguments
When passed a valid `:renderable` option (like an object that responds to `#render_in`), treat that object as both the `<turbo-stream>` element's template contents _and_ attempt to treat it as the target. For example, consider a simplified "component" class: ```ruby class Component extend ActiveModel::Naming def initialize(id:, content:) = (@id, @content = id, content) def render_in(...) = @content def to_key = [@id] end component = Component.new(id: 1, content: "Hello, world") turbo_stream.update(component) # => <turbo-stream action="update" target="component_1"><template>Hello, world</template></turbo-stream> ```
- Loading branch information
1 parent
33019f3
commit 5038ed8
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters