Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Creating ApplicationModel #12162
This PR creates the
class MyModelName < ActiveRecord::Base end
This inherits directly from
class MyModelName < ApplicationModel end
Awesome pull request, thank you! I've noticed several things:
Don't hesitate to ping me if you want some help.
Thanks! Given the very large scope of this PR could this be a right time to discuss extension vs composition?
I've seen some feedback of people discussing that directly subclassing from
class Person # Person is the root object under the problem domain. # The fact it uses AR::Base as a persistence implementation, shouldn't drive the domain class hierarchy. include ActiveRecord::Base # Or ApplicationModel end class Client < Person # Client is a domain-driven subclass of Person, so it makes sense for it to be an actual subclass end
The above would also make it more flexible to use
This change going to be a disruptive change to matter what, so it's a good time as any to discuss what's the best approach. Thanks again!
We already had this discussion in rails 4 and the conclusion was: there are
Also include also means inheritance in Ruby, so this change is not worth of