1. 4
  1.  

  2. 2

    Hey @dan_manges, great article. Thanks for writing.

    One thing I’d like clarified a bit: if you keep business logic out of the ActiveRecord models, where do you enforce relations (e.g., belongs_to and its ilk) and validations?

    1. 2

      We define relationships on our models. We put some simple validations in the models as well, but the more complex domain validations go in our services. Our services generally always return an object that has a .success? attribute, and if success is false, we’ll include a message with any validation errors.

      1. 1

        Not the original poster, but I think it’s fairly common to treat validations and relations as richer schema information. As opposed to model instance methods that query or update records.