Suggest a behavior change to the model's #at and #at_version methods (non-exclamation-mark versions).
What changes did you make? (overview)
When using #at(version: v) or #at_version(v) to attempt to get a specific version of a model instance, but log_data hasn't been set yet, return nil instead of the current behavior.
The current behavior is to raise NoMethodError ("undefined method 'version' for nil:NilClass"). For the non-exclamation-point versions of these methods, I believe it is less surprising to instead get nil.
Is there anything you'd like reviewers to focus on?
Please let me know if you like this idea, but would like some changes to this PR (such as actually mentioning this edge-case in the README.md).
What is the purpose of this pull request?
Suggest a behavior change to the model's
#at
and#at_version
methods (non-exclamation-mark versions).What changes did you make? (overview)
When using
#at(version: v)
or#at_version(v)
to attempt to get a specific version of a model instance, butlog_data
hasn't been set yet, returnnil
instead of the current behavior.The current behavior is to raise
NoMethodError
("undefined method 'version' for nil:NilClass"). For the non-exclamation-point versions of these methods, I believe it is less surprising to instead getnil
.Is there anything you'd like reviewers to focus on?
Please let me know if you like this idea, but would like some changes to this PR (such as actually mentioning this edge-case in the README.md).
Checklist