Method: VestalVersions::Control::ClassMethods#skip_version

Defined in:
lib/vestal_versions/control.rb

#skip_versionObject

The skip_version block simply allows for updates to be made to an instance of a versioned ActiveRecord model while ignoring all new version creation. The :if and :unless conditions (if given) will not be evaulated inside a skip_version block.

When the block closes, the instance is automatically saved, so explicitly saving the object within the block is unnecessary.

Example

user = User.find_by_first_name("Steve")
user.version # => 1
user.skip_version do
  user.first_name = "Stephen"
end
user.version # => 1


179
180
181
182
183
# File 'lib/vestal_versions/control.rb', line 179

def skip_version
  _with_version_flag(:_skip_version) do
    yield if block_given?
  end
end