Module: VestalVersions::Options::ClassMethods
- Defined in:
- lib/vestal_versions/options.rb
Overview
Class methods that provide preparation of options passed to the versioned
method.
Instance Method Summary collapse
-
#prepare_versioned_options(options) ⇒ Object
The
prepare_versioned_options
method has three purposes: 1.
Instance Method Details
#prepare_versioned_options(options) ⇒ Object
The prepare_versioned_options
method has three purposes:
-
Populate the provided options with default values where needed
-
Prepare options for use with the
has_many
association -
Save user-configurable options in a class-level variable
Options are given priority in the following order:
-
Those passed directly to the
versioned
method -
Those specified in an initializer
configure
block -
Default values specified in
prepare_versioned_options
The method is overridden in feature modules that require specific options outside the standard has_many
associations.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vestal_versions/options.rb', line 20 def () .symbolize_keys! .reverse_merge!(VestalVersions.config) .reverse_merge!( :class_name => 'VestalVersions::Version', :dependent => :delete_all ) # options.reverse_merge!( # :order => "#{options[:class_name].constantize.table_name}.#{connection.quote_column_name('number')} ASC" # ) class_attribute :vestal_versions_options self. = .dup .merge!( :as => :versioned, :extend => Array([:extend]).unshift(Versions) ) end |