Reading the code https://github.com/github/view_component/blob/0fd7cbf087248f3ce9c0becb4a00f598e361e3ea/lib/view_component/base.rb#L416 and documentation, I'm unsure we are able to use different formats like :xml or :text, right?
Problem:
I have a component that I want to render as :html and :text. For that, I created two views for my component, (i.e foo_component.html.haml and foo_component.text.haml. Somehow I expected to be able to pass the format to render, however I'm not able to, right?
Possible solution:
To render text "inline", I should have a method call to my class where I bypass any assigned template and render a string inline
Update
looks like I cannot have a template (i.e foo_component.html.haml) and implement the call method to deal with the inline rendering in the same class
Is that correct or did I miss anything? Any idea how to deal with that?
Reading the code https://github.com/github/view_component/blob/0fd7cbf087248f3ce9c0becb4a00f598e361e3ea/lib/view_component/base.rb#L416 and documentation, I'm unsure we are able to use different formats like
:xmlor:text, right?Problem:
I have a component that I want to render as
:htmland:text. For that, I created two views for my component, (i.efoo_component.html.haml and foo_component.text.haml. Somehow I expected to be able to pass the format torender, however I'm not able to, right?Possible solution:
To render text "inline", I should have a method
callto my class where I bypass any assigned template and render a string inlineUpdate
looks like I cannot have a template (i.e
foo_component.html.haml) and implement thecallmethod to deal with the inline rendering in the same classIs that correct or did I miss anything? Any idea how to deal with that?