Skip to content

Commit 1b97e10

Browse files
jonasjabarigitbook-bot
authored andcommitted
GitBook: [main] one page modified
1 parent 9e3a317 commit 1b97e10

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/ui-in-pure-ruby/html-rendering.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,24 @@ end
209209
</div>
210210
```
211211

212+
## Rails View Helpers
213+
214+
Using Rails view helpers \([https://api.rubyonrails.org/classes/ActionView/Helpers.html](https://api.rubyonrails.org/classes/ActionView/Helpers.html)\) in components, pages and apps is supported with some limitations currently. You just have to put a `plain` before a view helper, if this view helper is rendering a HTML string, for example:
215+
216+
```ruby
217+
plain link_to "Show", post_path(@post)
218+
```
219+
220+
{% hint style="info" %}
221+
A component needs to be called in context of a controller \(with included `Matestack::Ui::Core::Helper`\), which is true when you're calling components of Rails views or on Matestack Pages \(which are themselves called by a controller normally\).
222+
223+
When calling a component in isolation \(which is possible\), the view helpers might not work properly!
224+
{% endhint %}
225+
226+
{% hint style="danger" %}
227+
It's currently not possible to use view helpers requiring a block, such as the `form_for`. We're working on supporting them soon!
228+
{% endhint %}
229+
212230
## Custom HTML Tags
213231

214232
If you want to use HTML tags which are not supported by Matestack's rendering mechanism by default, you can call ActionView's `tag` helper manually:

0 commit comments

Comments
 (0)