#18 new
Jaryl Sim

State transitions do not persist to DB in ActiveRecord models

Reported by Jaryl Sim | April 12th, 2009 @ 05:07 PM

foo.bar! does not persist to the database due to a failed validation. The documentation for the WriteState::aasm_write_state method indicates that update_attribute is being used to bypass validation, but this is not the case.

After calling write_attribute, save is being called to persist the changes. Since save does validation, this breaks the design of state transitions in AASM.

A proposed fix would be to call save(false) to skip validation, see pastie:


Comments and changes to this ticket

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.