I have a class sitting in /lib folder.
It’s in a file called mailing.rb
And I would like to use this class in codes from app/controller.
How do i do this?
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.
Rails 3 no longer automatically loads the files from
lib.In your
application.rbfile, you can addlibto your autoload_paths:This way, your
mailer.rband all other files inlibwill be available to the rest of your application.