state-machines/state_machines

State predicates should not override existing methods

magni- opened this issue · 0 comments

When defining a state machine, Machine#define_state_predicate first checks to see whether the method it would add is already defined or not. However, when defining a state, State#add_predicate does no such check.

We had a machine with a destroyed check work fine until we started to upgrade to Rails 5.2, because that version of Rails adds a check for destroyed? in its create_or_update method.

Ideally, there would be a warning just like there is when defining a state already defined on another state machine on the same model.

edit: from this test case, it looks like this should already work?