Sha256: fb67bf02fc197d49f88fd92838b8d35f821a79c3275ec629ca186610fce37a3c

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require 'spree_core'
require 'spree_zone_pricing_hooks'

module SpreeZonePricing

  class Engine < Rails::Engine

    config.autoload_paths += %W(#{config.root}/lib)

    def self.activate

=begin
      Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
        Rails.env.production? ? require(c) : load(c)
      end

      ::Product.class_eval do
        accepts_nested_attributes_for :translations
      end
      
      ::ProductProperty.class_eval do
        accepts_nested_attributes_for :translations, :reject_if => proc { |attributes| attributes['value'].blank? }
        validates_presence_of :value
      end
      
      ::Property.class_eval do
        accepts_nested_attributes_for :translations
      end
      
      ::Taxon.class_eval do
        accepts_nested_attributes_for :translations
      end

      ::OptionType.class_eval do
        accepts_nested_attributes_for :translations, :reject_if => proc { |attributes| attributes['presentation'].blank? }
        accepts_nested_attributes_for :option_values, :allow_destroy => true
      end

      ::OptionValue.class_eval do
        accepts_nested_attributes_for :translations, :reject_if => proc { |attributes| attributes['presentation'].blank? }
        validates_presence_of :name
      end
=end

    end

    config.to_prepare &method(:activate).to_proc

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_zone_pricing-0.1.10 lib/spree_zone_pricing.rb