lib/state_machine/machine.rb in state_machine-0.9.1 vs lib/state_machine/machine.rb in state_machine-0.9.2

- old
+ new

@@ -417,10 +417,16 @@ def initialize(owner_class, *args, &block) options = args.last.is_a?(Hash) ? args.pop : {} assert_valid_keys(options, :attribute, :initial, :action, :plural, :namespace, :integration, :messages, :use_transactions) # Find an integration that matches this machine's owner class - if integration = options[:integration] ? StateMachine::Integrations.find(options[:integration]) : StateMachine::Integrations.match(owner_class) + if options.include?(:integration) + integration = StateMachine::Integrations.find(options[:integration]) if options[:integration] + else + integration = StateMachine::Integrations.match(owner_class) + end + + if integration extend integration options = integration.defaults.merge(options) if integration.respond_to?(:defaults) end # Add machine-wide defaults