Skip to content

Documentation for magic-state-checking methods #238

@istrasci

Description

@istrasci

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions