instance method
turbo_refreshes_with
Ruby on Rails 2.0.23
Since v2.0.23 Last seen in v2.0.23Signature
turbo_refreshes_with(method: :replace, scroll: :reset)
Configure how to handle page refreshes. A page refresh happens when Turbo loads the current page again with a replace visit:
Parameters:
-
method- Method to update the +<body>+ of the page during a page refresh. It can be one of:-
replace:: Replaces the existing +<body>+ with the new one. This is the
default behavior.
-
morph:: Morphs the existing +<body>+ into the new one.
-
-
scroll- Controls the scroll behavior when a page refresh happens. It can be one of:-
reset:: Resets scroll to the top, left corner. This is the default. -
preserve:: Keeps the scroll.
-
Example Usage:
turbo_refreshes_with(method: :morph, scroll: :preserve)
Parameters
-
methodkey = :replace -
scrollkey = :reset
Source
# File app/helpers/turbo/drive_helper.rb, line 70
def turbo_refreshes_with(method: :replace, scroll: :reset)
provide :head, turbo_refresh_method_tag(method)
provide :head, turbo_refresh_scroll_tag(scroll)
end
Defined in app/helpers/turbo/drive_helper.rb line 70
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Turbo::DriveHelper