DEV Community

Discussion on: Write clean Object-Oriented code by replacing conditional with polymorphism

Collapse
alexandreruban profile image
Alexandre Ruban Author

Hey! Thank you very much for your comment!

We could move non-ActiveRecord models in app/value_objects if we wanted to. However, when looking at a Ruby object, we feel more concerned about what it does - the methods it responds to - rather than its class/inheritance hierarchy.

When you look at the Rails source code, you can see that some non-ActiveRecord objects like ActiveStorage::Variant are in app/models. DHH also says that all models are not necessarily ActiveRecord in his great video series "On writing software well"; I highly recommend it if you want to see a bit of Basecamp's code!