link_to helper shows a tags as string #247
|
I've read rails helpers are not completely integrated, is this something that is not yet implemented? |
Replies: 2 comments
|
That's right, we haven't adapted the You could always define your own adapter def link_to(...)
raw helpers.link_to(...)
endOr use def link_to(something, **attributes, &block)
a(**attributes, href: helpers.url_for(something), &block)
endNow you can use it like this. link_to(@article, class: "bla") { "Hello" }The advantage of being able to pass a block is you can continue to use Phlex to put HTML inside the link. link_to @article do
h1 { "Inside link" }
endI expect we will ship an adapted |
|
@merongivian 👋 hey, coming back to your question about |
@merongivian 👋 hey, coming back to your question about
link_to,phlex-railsnow supports all Rails helpers via adapters which you can include as needed. To uselink_to, just includePhlex::Rails::Helpers::LinkToand it should work as expected.