:next_version method doesn't return anything for the most recent version #200

Closed
batter opened this Issue Feb 5, 2013 · 0 comments

Comments

Projects
None yet
1 participant
@batter
Collaborator

batter commented Feb 5, 2013

Say you have a model named Document which declares has_paper_trail.

> d = Document.create!
=>  #<Document id: 1, name: nil>
> d.update_attribute(:name, 'Ben')
=> true
> d.update_attribute(:name, 'Andy')
=> true
> d.previous_version
=> #<Document id: 1, name: "Ben">
> d.previous_version.next_version
=> nil # should return the live version (#<Document id: 1, name: "Andy">)

The next_version method is currently broken, in that if it is called on the latest reified version of a model prior to the live model, it returns nil when it should actually return the live model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment