I have a function (creation of a record in a table) that must be executed within before_save routines of models. What is the preferred way to do it? I am in Rails 3.1.
A module in lib?
A class in lib?
application.rb?
Any example?
Thanks
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.
Module in
lib/. Why a class if it’s just a function? And don’t clutterapplication.rb.