I am writing a helper that needs to call another helper, which generates html. How do I do that?
To call another function in the same helper, use the syntax: this. methodName , where this is a reference to the helper itself. For example, helperMethod2 calls helperMethod3 with this code.
In Rails 5, by using the new instance level helpers method in the controller, we can access helper methods in controllers.
try:
include AnotherHelper
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With