Getting name of currently rendering ERb template in view?

If I’m writing code in a template and I want to refer to the name of the
template itself so that I can pass it to a helper method, is there a
built-in variable (like controller_name or action_name) that I can use.

Assume x.rhtml and in this template I have helper_method(). I want to
pass “x.rhtml” into helper_method without hardcoding it.

Do I have access to the currently rendering template name?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs