airblade/paper_trail — pull request #348 by kiela (2014-03-27 13:59:08+00:00)
Title: Fix retrieving :has_one association

Some weird situation came up when I was working with Paper Trail. I have:
- created an instance of `Category` and `Post` models
- added several different categories to DB
- created new instance of `Post`, associated it with one `Category` and save to the DB
- edited several times the post without editing the associated category
- added controller which shows different versions of posts and associated categories
- tried to show choosen version of the post - here where the problem occurred

In my controller I have tried to retrieve proper version of the post by executing `Version.find(params[:id]).reify(has_one: true)`. Although this command found proper version of `Post` it wasn't be able to find the proper version of `Category`. The problem is here: https://github.com/airblade/paper_trail/blob/ffd7bc233a18f1910588bd0c51a572a235da3c98/lib/paper_trail/version_concern.rb#L201 PaperTrail tried to fetch version of `Category` from max 3 seconds (by default) before chosen version of `Post` was created.

I think the better idea is to drop `lookback` option and fetch proper version of `:has_one` association by using `.version_at`.

I know that I need to update [`README.md`](https://github.com/airblade/paper_trail/blob/ffd7bc233a18f1910588bd0c51a572a235da3c98/README.md) and comments in the code as well, but firstly I want to get some feedback from the maintainers.