workflow
workflow copied to clipboard
Documentation for magic-state-checking methods
It seems that you can check if the object object/workflow is in a particular state by calling a magic state_name?
method. Unless I'm missing something, all I see in the documentation regarding these magic methods is the following in the README:
Let’s create an article instance and check in which state it is:
article = Article.new article.accepted? # => false article.new? # => true
I was unaware of this functionality, and it recently got me into trouble in my app. I had defined a :started
state, but also created my own method called started?
. Only after debugging incorrect behaviour did I figure out my own method was not being called.
It would be nice if the documentation described this behaviour and explained it more clearly/explicitly.