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

I am trying to implement gent_manine in my rails project, I installed gem, then added the "state" column to my account_entries model:

  def change
    add_column :account_entries, :state, :string
  end

Then, in my account_entries model, I added an initial main logic machine, like this:

state_machine :state, :initial => :submitted do

end

Then, in my opinion, I show the state of the time record:

account_entry.state

But when I try to create account_entry from my application, I get this error:

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

He says this on line 4 of my account_entries controller, this is line 4 of my account_entries controller.

e.account_entries.create(params.require(:account_entry).permit(:time, :account_id))

This is mistake? Or is it my problem? How can i solve this? What does the error message mean?

+4
1

state_machine. , , , around_validation public:

# config/initializers/state_machine_patch.rb
# See https://github.com/pluginaweek/state_machine/issues/251
module StateMachine
  module Integrations
     module ActiveModel
        public :around_validation
     end
  end
end
+15

Source: https://habr.com/ru/post/1568465/


All Articles