Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I call a Rails helper method from inside another helper method?

I am writing a helper that needs to call another helper, which generates html. How do I do that?

like image 973
picardo Avatar asked Aug 09 '10 03:08

picardo


People also ask

How do you call one helper method from another helper method?

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.

Can we use helper method in controller Rails?

In Rails 5, by using the new instance level helpers method in the controller, we can access helper methods in controllers.


1 Answers

try:
include AnotherHelper

like image 148
psjscs Avatar answered Sep 21 '22 04:09

psjscs