-
Notifications
You must be signed in to change notification settings - Fork 74
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
association_versioning
with ignore_log_data: true
causes MissingAttributeError
#114
Comments
When you call And it fails since the You need to use Which seems confusing. @DmitryTsepelev Maybe, we should apply |
Makes sense. I'll take a closer look later this week, @dmills-yesware thanks for pointing this out! |
Thanks for the quick response!
Ah, excellent. I had tried that, but not before first trying to load [34] pry(main)> p.comments.length
[35] pry(main)> p.comments.with_log_data.length
As long as the first attempt to load the relation includes [40] pry(main)> Post.with_log_data.last.at(time: Time.now).comments.with_log_data.at(time: Time.now).length
Worth noting: It does appear that I need to repeat the Thanks again. |
Looks like a bug. Associations should inherit the |
@dmills-yesware FYI I think I have a solution as a part of my ongoing PR - I decided to avoid making a separate one because that PR touches |
Fixed in 0.10.0, @palkan I guess we can close this issue |
I'm taking
logidze
for a spin and it seems to be a great fit for our needs, but I've encountered what appears to be a bug. Withassociation_versioning
andignore_log_data
turned on, after retrieving a copy of the model at a given point in time usingat
, I'm then unable to retrieve the associated records, instead receiving the errorActiveModel::MissingAttributeError: missing attribute: log_data
.Ruby version: 2.3.5
ActiveRecord version: 4.2.10
The issue vanishes if I either turn off
ignore_log_data
on the associated model (ie. theComment
model in the example below) or disable association versioning. So far I haven't found a way to work around the issue.Steps to reproduce, based on the association tracking example:
Migrations
Models
Code to reproduce
[24] pry(main)> p = Post.create(title: "New Post", content: "Bug hunting")
[25] pry(main)> p = Post.with_log_data.last
[26] pry(main)> p.comments.create(body: "First comment")
[27] pry(main)> p.at(time: Time.now)
[28] pry(main)> p.comments.length
I hope that helps. Let me know if I can provide any additional details that might be useful. And thanks for the great work on this library!
The text was updated successfully, but these errors were encountered: