state_machine: NoMethodError: protected method `around_validation' in Rails 4.1.0.beta1

Store.first.save
  Store Load (0.9ms)  SELECT  "stores".* FROM "stores"   ORDER BY created_at LIMIT 1
   (0.2ms)  BEGIN
   (0.1ms)  ROLLBACK
NoMethodError: protected method `around_validation' called for #<StateMachine::Machine:0x007f674cc70f78>

The model has just statemachine

  belongs_to :vendor
  state_machine :state, :initial => :new do
  end

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Reactions: 1
  • Comments: 38

Commits related to this issue

Most upvoted comments

👍

If you’d like a quick hack, I threw this in my initializers:

# Rails 4.1.0.rc1 and StateMachine don't play nice

require 'state_machine/version'

unless StateMachine::VERSION == '1.2.0'
  # If you see this message, please test removing this file
  # If it's still required, please bump up the version above
  Rails.logger.warn "Please remove me, StateMachine version has changed"
end

module StateMachine::Integrations::ActiveModel
  alias_method :around_validation_protected, :around_validation
  def around_validation(*args, &block)
    around_validation_protected(*args, &block)
  end
end