New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updated_at timestamp is filled on create #300
Comments
Thats correct and intended behavior. Thats how other ORM's I have used work as well |
If the updated_at is set on create then when sorting by updated_at, this way the unmodified records will be placed between the modified ones when sorting by updated_at. We could create a way to unset this behavior via a model attribute but I would advise against it. Is there a reason you would want this? |
Hi Joe Thanks for the clarification on this. I was expecting the updated_at column to be empty (NULL) on initial record creation as this would indicate it had never been updated. As this is expected and I now understand the reasoning behind it, You can close this issue. Thanks for the clarification and keep up the great work. |
Oops Didnt realise I could close this ;) |
Yeah. When I researched this a bit I found some different opinions but most were sorta closed out and made it seem like they stayed with the default behavior. To get records that are not updated you can do something like this: User.where_column('updated_at', '=', 'created_at') and records updated: User.where_column('updated_at', '>', 'created_at') |
Yeah I figured that out after you clarified the usage pattern Cheers |
Just updated to 1.0.0 YAY!
Noticed an issue when using .create that the updated_at field gets the same timestamp as created_at when creating a new model.
Haven't had time to investigate this yet so I'm just adding it here
The text was updated successfully, but these errors were encountered: