By convention, Rails only “attaches” the view helper which corresponds to the controller the erb file is called of.
How can I access a view helper’s methods of an arbitrary view helper in Rails?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you need to do that, something is wrong with the organization of your code. Instead, move the helper methods that both of your views need into a common module, and include that module in both.
For example, if you have:
and you want /bananas views to have access to the
flavor_ofmethod, then do this:Update: I realized that I didn’t actually answer the original question directly. The way to include another helper in a view is with
helper:Now all /bananas view also have the ApplesHelper methods available to them.