I use paper_trail in rails to track my models versions. But the documentation on the github repo indicates that the gem doesn't support has_many
, belongs_to
associations.
Let's say I've an app that records the ceos names of some comapnies:
class Company < ActiveRecord::Base
has_many :ceos
has_paper_trail
end
class Ceo < ActiveRecord::Base
belongs_to :companies
has_paper_trail
end
The above example represent the information of ABC Inc.
company.name => "ABC"
company.ceo.past => "John Henry"
company.ceo.present => "Amy Warren"
How can I implement the following operation so it will reset the company and the company's ceos names to the last version?