#8 new
Zoltan Varady

:new state conflicts with ActiveRecord

Reported by Zoltan Varady | October 9th, 2008 @ 10:36 AM

Since AASM is creating ActiveRecord named scopes, it will overwrite the model's 'new' method if you have a state named 'new', and thus will probably break your app. This was quite confusing for me, especially since the example in the README has a state named 'new' too.

At the very least the state in the example should be renamed. It would be even better if AASM would issue a warning or raise an exception before overriding a built-in method.

Comments and changes to this ticket

  • rubyist

    rubyist October 9th, 2008 @ 11:50 AM

    Indeed this is the case - I will add warnings for overridden methods as well as changing the example.

    Thanks -Scott

    On Oct 9, 2008, at 10:36 AM, Lighthouse wrote:

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Library for adding state machines to Ruby classes. Includes persistence layers for things like ActiveRecord. Formerly known as acts_as_state_machine.

People watching this ticket