Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Make require: true the default for Model#fetch #2006
When fetching a single model there is usually a precise set of constraints, so as a user I'm interested in getting that model, not any other value. This is especially true when logging in a user, or when looking for a specific record of something. Usually all further processing of said model should be skipped since it wouldn't make sense, so this facilitates that mechanism by default.
This change ensures that fetch calls like:
will always resolve with a model, avoiding the need to additionally check if the result is not
This adds a new
The new model level property also means that users that prefer the previous behavior can easily adapt their code by simply adding
There is a migration guide in the Wiki to help with the transition to this new default.
Current PR Issues
This does not change the default behavior when fetching collections, mainly because it's not easy to catch an
Not everyone is going to like this change, but it should be relatively easy to keep using the previous behavior for those that prefer to think is terms of SQL and less about abstract higher level objects.
There are some commits in this series that actually made