Module | SoftwareHeretics::ActiveRecord::SimplyVersioned::InstanceMethods |
In: |
lib/simply_versioned.rb
|
Revert this model instance to the attributes it had at the specified version number.
# File lib/simply_versioned.rb, line 41 41: def revert_to_version( version ) 42: version = if version.kind_of?( Version ) 43: version 44: else 45: version = self.versions.find( :first, :conditions => { :number => Integer( version ) } ) 46: end 47: self.update_attributes( YAML::load( version.yaml ) ) 48: end