Example View Component will not render. #2002
-
Using the example view component in the docs, I can't get a rails app to render a component. Currently I'm trying to use a file called class ExampleComponent < ViewComponent::Base
erb_template <<-ERB
<span title="<%= @title %>"><%= content %></span>
ERB
def initialize(title:)
@title = title
end
end Is this even valid syntax? When I split it up like so, it does work: <span title="<%= @title %>"><%= content %></span>
class ExampleComponent < ViewComponent::Base
def initialize(title:)
@title = title
end
end Why does the example given in the docs not render?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @pseudogram, do you happen to see an error message when you use the syntax from the docs? Can you let us know which version of ViewComponent you're using? |
Beta Was this translation helpful? Give feedback.
I was using 2.something 🤦
Installed 3.11 and it worked.