Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protected method `around_validation' ERROR #348

Open
kaiomagalhaes opened this issue Feb 29, 2016 · 3 comments
Open

protected method `around_validation' ERROR #348

kaiomagalhaes opened this issue Feb 29, 2016 · 3 comments

Comments

@kaiomagalhaes
Copy link

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
Copy link

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
Copy link
Author

@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
Copy link

anklos commented Mar 27, 2017

thanks for the patch. just met the same issue.

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

francois added a commit to Bus-com/state_machine that referenced this issue Jun 14, 2017
On Rails 4.2, state_machine is broken due to using `public_send` instead of a plain `send`. This patch is simply a formalized version of pluginaweek#348.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants