Module: VestalVersions::Creation::ClassMethods

Defined in:
lib/vestal_versions/creation.rb

Overview

Class methods added to ActiveRecord::Base to facilitate the creation of new versions.

Instance Method Summary collapse

Instance Method Details

#prepare_versioned_options(options) ⇒ Object

Overrides the basal prepare_versioned_options method defined in VestalVersions::Options to extract the :only, :except and :initial_version options into vestal_versions_options.



18
19
20
21
22
23
24
25
26
# File 'lib/vestal_versions/creation.rb', line 18

def prepare_versioned_options(options)
  result = super(options)

  self.vestal_versions_options[:only] = Array(options.delete(:only)).map(&:to_s).uniq if options[:only]
  self.vestal_versions_options[:except] = Array(options.delete(:except)).map(&:to_s).uniq if options[:except]
  self.vestal_versions_options[:initial_version] = options.delete(:initial_version)
  
  result
end