DEV Community

Discussion on: How to migrate Rails UJS to Hotwire (Turbo)

Collapse
 
bakivernes profile image
Vernes Pendić

Hi Thomas! I'm having issues with: link_to, url, method: :get. The link goes to a controller action that response with turbo_stream but the request arrives as HTML and I get an error after removing ujs. Tried adding data-turbo-method="get" but because my link is inside a turbo-frame it says Response has no matching <turbo-frame id="idOfRandomParent"> element. Did you by any chance encounter such issues?

Collapse
 
thomasvanholder profile image
thomasvanholder

@bakivernes, you can break out a turbo_frame by specifing the target attribute on a link.

link_to 'root', root_path, target:"_top"
# alternative
link_to 'root', root_path, data: { turbo_frame: '_top' }
Enter fullscreen mode Exit fullscreen mode

See also here