lib/state_machine/machine.rb in state_machine-0.10.3 vs lib/state_machine/machine.rb in state_machine-0.10.4

- old
+ new

@@ -419,17 +419,17 @@ options = args.last.is_a?(Hash) ? args.pop : {} assert_valid_keys(options, :attribute, :initial, :initialize, :action, :plural, :namespace, :integration, :messages, :use_transactions) # Find an integration that matches this machine's owner class if options.include?(:integration) - integration = StateMachine::Integrations.find(options[:integration]) if options[:integration] + @integration = StateMachine::Integrations.find_by_name(options[:integration]) if options[:integration] else - integration = StateMachine::Integrations.match(owner_class) + @integration = StateMachine::Integrations.match(owner_class) end - - if integration - extend integration - options = (integration.defaults || {}).merge(options) + + if @integration + extend @integration + options = (@integration.defaults || {}).merge(options) end # Add machine-wide defaults options = {:use_transactions => true, :initialize => true}.merge(options)