pluginaweek / state_machine

Adds support for creating state machines for attributes on any Ruby class
http://www.pluginaweek.org
MIT License
3.74k stars 505 forks source link

protected method `around_validation' ERROR #348

Open kaiomagalhaes opened 8 years ago

kaiomagalhaes commented 8 years ago

While using the gem with rails 4.2 I have faced the following issue:

protected method `around_validation' called for #<StateMachine::Machine:0x00000004f953e0>

To fix this I have to add a monkey patch. I added the following code inside config/initializers/state_machine_patch.rb

module StateMachine
  module Integrations
    module ActiveModel
      public :around_validation
    end
  end
end

There is any best way to fix it?

twalpole commented 8 years ago

This gem isn't supported anymore - check out the fork at https://github.com/state-machines/state_machines to see if it'll work for you

kaiomagalhaes commented 8 years ago

@twalpole Thanks for the information. The bad thing is that with this fork it shows up another error

ActiveRecord::RecordNotFound:
       Couldn't find Company with 'id'=
     # /var/lib/gems/2.2.0/gems/activerecord-4.2.5/lib/active_record/core.rb:155:in `find'
     # ./spec/models/company_spec.rb:17:in `block (3 levels) in <top (required)>'
anklos commented 7 years ago

thanks for the patch. just met the same issue.

this is a very useful gem, would be sad to see it left unmaintained.