You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So we can have an ActiveRecord-like interface for our model structs.
Basic methods:
An all, index method (with optional pagination parameters) to fetch all the records.
A create method which INSERTs a new record in the database..
An update method which UPDATEs an existing record.
An destroy method which DELETEs an existing record.
Some of these methods have already been implemented in the User model, so this is will come down to abstracting that functionality.
A more difficult extension to this trait is tracking which fields of the record have been changed so we can UPDATE only changed fields. This seems cleaner, but would require a lot of bookkeeping.
The text was updated successfully, but these errors were encountered:
So we can have an ActiveRecord-like interface for our model structs.
Basic methods:
all
,index
method (with optional pagination parameters) to fetch all the records.create
method whichINSERT
s a new record in the database..update
method whichUPDATE
s an existing record.destroy
method whichDELETE
s an existing record.Some of these methods have already been implemented in the
User
model, so this is will come down to abstracting that functionality.A more difficult extension to this trait is tracking which fields of the record have been changed so we can
UPDATE
only changed fields. This seems cleaner, but would require a lot of bookkeeping.The text was updated successfully, but these errors were encountered: