Where do most Rails apps usually keep their non-active-record classes?
In app/models?
In lib/some_file.rb?
Someplace else?
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.
It depends what is the purpose of this class. If this is something like a model. On example, by default mailers are put in
app/modelsand it isn’t ActiveRecord. If you want to add some classes that are used in your application in many places and it isn’t model-related, then probably the best place is to put it in alibdirectory. If you want to reuse it, you can also create a plugin with your class and then it would be placed invendor/plugins.You can also put it in
config/initializersif it fits into this category.To sum up: it depends what your class is about. Put it in a place where it fits. If you have doubts, put it in
libdirectory.