act_as_revisable returns ObjectRevision instead of just Revision
I have a model Item:
class Item < ActiveRecord::Base
acts_as_revisable
end
When I try to use Item.find(2, :with_revisions) it comes back as an ItemRevision class instead of an Item class and I can'开发者_开发百科t do things like assigning from another model (i.e. ItemList.items << item).
Is there a way to make it return Item or a way to make it into an Item?
When you have a revision object you can call a method on it to get what it's a revision for:
@page.revisions.first.page
In this example I have the Page model which has versions for its records, and on every version there is a page
method to get the object to which that version references.
精彩评论