Skip to content

Commit

Permalink
Hooks should be loaded in activate to avoid repeated application.
Browse files Browse the repository at this point in the history
  • Loading branch information
romul committed Aug 16, 2010
1 parent 5c966fd commit e1ae1f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions promotions/lib/spree_promotions.rb
@@ -1,10 +1,10 @@
require 'spree_core'
require 'spree_promotions_hooks'

module SpreePromotions
class Engine < Rails::Engine
def self.activate
lambda{
require 'spree_promotions_hooks'
# put class_eval and other logic that depends on classes outside of the engine inside this block
Product.class_eval do
has_and_belongs_to_many :promotion_rules
Expand Down Expand Up @@ -75,4 +75,4 @@ def eligible_automatic_promotions
config.autoload_paths += %W(#{config.root}/lib)
config.to_prepare &self.activate
end
end
end

0 comments on commit e1ae1f1

Please sign in to comment.