0

How would I be able to use an event called ship in AASM if I also have a Rails model with that name?

event :ship do
   transitions :from => :quoted, :to => :shipped
end
class Ship < ApplicationRecord
end

Whenever I call the Rails method .ship AASM gets triggered and throws an error.

Is renaming my Ship model to Vessel the only way to solve this problem?

Tintin81
  • 9,821
  • 20
  • 85
  • 178

1 Answers1

0

You should rename something: either event, or association:

belongs_to :vessel, class_name: “Ship”

Another alternative is to use namespace for state machine events

Tema Bolshakov
  • 1,128
  • 8
  • 14