Hello. I am designing an application on Ruby on Rails. Frequently used parts of the application, I think, should be placed in the library (lib /). The question arose: is it possible to access models from libraries without crutches?
- What for? imkho, the library should not depend on specific model. - user1855
|
1 answer
Write libraries with autonomous logic, and the model can act as a parameter in an instance of this class.
Or create a module, stuff everything you need into it, and then add this module to the model.
For example, the auxiliary model for the user
|