I have defined my helper function in Helper:
module CarsHelper
def my_helper
...
end
end
But I can neither used it(my_helper) in my CarsController nor in Car model, is it so that the custom helper can only be used in View?
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.
Helpers are normally for views. But you can include them in your controllers as well. Just add
to your controller. (docs)
Models are out of scope for helpers. Use class or instance methods in there instead.