...

/

Database Operations with Class Methods

Database Operations with Class Methods

Learn how class methods should be used in the database operations of our Rails application.

Database manipulation in Rails

If we look at the class methods that are provided by Rails (excluding the DSL methods previously discussed), they all center around providing ways of accessing the underlying database. This is a good guide for the types of methods we should add. But we would recommend only adding methods to facilitate reuse. Another way to say this is to add class methods to the Active Record only if both of these criteria hold:

  • There is a need for the
...