Integrating Action View Helpers
Using Rails view helpers (https://api.rubyonrails.org/classes/ActionView/Helpers.html) in components, pages and layouts is supported when using the approaches shown below;
Helpers without a block
Simple Action View helpers working without a block, can easily be integrated in a Matestack class response by calling plain
:
Helpers yielding a block
If you want to use a helper like form_for
you have to follow following approach:
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 from Rails views or on Matestack Pages/Layouts (which are themselves called by a controller normally).
When calling a component in isolation (which is possible), the view helpers might not work properly, especially when (implicitly) requiring a request object!
We're currently working on an improved way to integrate ActionView Helpers which will enable removing the plain
calls from your code.
Last updated