-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong Content-Type with HAML #287
Comments
Yeah! Can confirm the bug and the solution! Have you managed to find a more generic solution / patch to the issue? Edit: Actually, this comment: #80 (comment) clarified that just adding |
I know it's against current Rails defaults about file naiming rules what was caused by flexible .erb format but let's not forget that haml is always html. Therefore semantically it's rather redudant and noisy to declare html multilpe times that haml is html where it never can be anything else. I work with view files rather often where I inspect files in tree in command line and it's rather important they are short and clear without redudant html noise. Therefore I support any effort to keep semantically correct .haml format as well. |
Just ran across this today during my work on a |
It seems that as a result of e693f45e155a81b6c337b8766870b56716a05105 from 13 years ago which has made its way here, we can do the following as a 'fix' for omitting the module Haml
class Plugin
def default_format
:html
end
end
end
# Or,
module Hamlit
class RailsTemplate
def default_format
:html
end
end
end |
Seems like this is a general Rails issue. Would be happy to take a doc change to turbo-rails explaining the naming convention needs, though. |
the monkey patch suggested by @Aesthetikx works great on haml 5.2.2, but it doesn't look as if it's going to work on haml 6.0, as there's no plugin class to hold the monkey-patch |
I made a pull request for haml6 to incorporate @Aesthetikx monkey patch, haml/haml#1144 |
When views templates are written in ERB and contain a turbo_frame_tag, then for a request with the turbo-streams type, the response correctly uses the HTML content-type
text/html
.But when templates are in HAML, then for a turbo-streams request, the response incorrectly uses the turbo-stream content-type
text/vnd.turbo-stream.html
, and the JS side fails to update the turbo frame because it expects the HTML content-typetext/html
.A temporary workaround that helps to fix this problem is to force the correct HTML content-type with e.g.:
The text was updated successfully, but these errors were encountered: