lib/vestal_versions/options.rb in vestal_versions-1.0.2 vs lib/vestal_versions/options.rb in vestal_versions-2.0.0

- old
+ new

@@ -1,13 +1,9 @@ module VestalVersions # Provides +versioned+ options conversion and cleanup. module Options - def self.included(base) # :nodoc: - base.class_eval do - extend ClassMethods - end - end + extend ActiveSupport::Concern # Class methods that provide preparation of options passed to the +versioned+ method. module ClassMethods # The +prepare_versioned_options+ method has three purposes: # 1. Populate the provided options with default values where needed @@ -21,19 +17,19 @@ # # The method is overridden in feature modules that require specific options outside the # standard +has_many+ associations. def prepare_versioned_options(options) options.symbolize_keys! - options.reverse_merge!(Configuration.options) + options.reverse_merge!(VestalVersions.config) options.reverse_merge!( :class_name => 'VestalVersions::Version', :dependent => :delete_all ) - options.reverse_merge!( - :order => "#{options[:class_name].constantize.table_name}.number ASC" - ) + # options.reverse_merge!( + # :order => "#{options[:class_name].constantize.table_name}.#{connection.quote_column_name('number')} ASC" + # ) - class_inheritable_accessor :vestal_versions_options + class_attribute :vestal_versions_options self.vestal_versions_options = options.dup options.merge!( :as => :versioned, :extend => Array(options[:extend]).unshift(Versions)