We tried upgrade my rails application from 5.0.2 to 5.1.0, it uses cells 4.1.7 and cells-slim 0.0.5. and I saw a lot of escaped strings in cells components...
I guessed it is effected by new tag syntax in rails 5.1.
Rendering slim on cells
/ Traditional syntax
= content_tag :a, href: root_path
strong Back to root page
/ New syntax on Rails 5.1
= tag.a href: root_path
strong Back to root page
/ URL helper
= link_to root_path
strong Back to root page
Output in Rails 5.0.2
<a href="/"><strong>Back to root page</strong></a>
<a href="/"><strong>Back to root page</strong></a>
<a href="/"><strong>Back to root page</strong></a>
Output in Rails 5.1.0
<a href="/"><strong>Back to root page</strong></a>
<a href="/"><strong>Back to root page</strong></a>
<a href="/"><strong>Back to root page</strong></a>
Quick-fix
As a workaround makeshift, it seems to be able to deal this problem with overriding #tag_builder private method as below. Currently we are adding this to ApplicationCell and using it as a parent cell.
class ApplicationCell < Cell::ViewModel
private
def tag_builder
super.tap { |builder| builder.class_eval { include Cell::Slim::Rails } }
end
end
But this approach have over-included unnecessary methods (e.g. for FormTagHelper). It would be great if cells-slim supports 5.1 new methods correctly.
We tried upgrade my rails application from 5.0.2 to 5.1.0, it uses cells 4.1.7 and cells-slim 0.0.5. and I saw a lot of escaped strings in cells components...
I guessed it is effected by new tag syntax in rails 5.1.
Rendering slim on cells
Output in Rails 5.0.2
Output in Rails 5.1.0
Quick-fix
As a workaround makeshift, it seems to be able to deal this problem with overriding
#tag_builderprivate method as below. Currently we are adding this toApplicationCelland using it as a parent cell.But this approach have over-included unnecessary methods (e.g. for FormTagHelper). It would be great if cells-slim supports 5.1 new methods correctly.