-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add Persistence#bitemporal_at and ActiveRecord::Bitemporal.bitemporal_at #152
Conversation
4f57920
to
8660a03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
let!(:company) { Company.create(name: "Company") } | ||
before do | ||
emp = company.employees.create(name: "Jane") | ||
emp.address = Address.create(name: "Address") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to use create_address
?
In the current code, the address.employee_id
is updated after the Address is created.
emp.address = Address.create(name: "Address") | |
emp.create_address(name: "Address") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦 You're right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8660a03
to
7d7cb6d
Compare
Co-authored-by: kitazawa <3143443+krororo@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This PR introduces
Persistence#bitemporal_at
andActiveRecord::Bitemporal.bitemporal_at
, which help you set a valid time and a transaction time at the same time.This is inspired by the already existing
bitemporal_at
scope and improves the consistency of the interface: