lib/acts_as_versioned.rb
def revert_to(version)
          if version.is_a?(self.class.versioned_class)
            return false unless version.send(self.class.versioned_foreign_key) == id and !version.new_record?
          else
            return false unless version = versions.find_by_version(version)
          end
          self.clone_versioned_model(version, self)
          send("#{self.class.version_column}=", version.version)
          true
        end
# Reverts a model to a given version.  Takes either a version number or an instance of the versioned model
Reverts a model to a given version.  Takes either a version number or an instance of the versioned model
Reverts a model to a given version . Takes either a version number or an instance of the versioned model
def revert_to(version)
          if version.is_a?(self.class.versioned_class)
            return false unless version.send(self.class.versioned_foreign_key) == id and !version.new_record?
          else
            return false unless version = versions.find_by_version(version)
          end
          self.clone_versioned_model(version, self)
          send("#{self.class.version_column}=", version.version)
          true
        end
def revert_to ( version ) if version . is_a? ( self . class . versioned_class ) return false unless version . send ( self . class . versioned_foreign_key ) == id and ! version . new_record? else return false unless version = versions . find_by_version ( version ) end self . clone_versioned_model ( version , self ) send ( "#{self.class.version_column}=" , version . version ) true end
Reverts a model to a given version.
Reverts a model to a given version .
version