Closed benzelano closed 13 years ago
Morgan Christiansson commented
I committed a test here: https://github.com/morganchristiansson/state_machine/commit/268bf65651a054cd0206c9ee36acd7c45a2b9bb6
Also I’m surprise that calling @table.children.map(&:id) before update_attributes decides whether :state_event is set after update_attributes.
Let me know if you want more details or a cleaner test. Previous tests I’ve submitted have been rewritten anyway, so I thought I wouldn’t spend too much time perfecting them.
Thanks!
Morgan -
Thanks for the heads up! I believe this may very well be an integration issue with ActiveRecord whereby a change to that attribute doesn’t mark the record as dirty and, as a result, doesn’t case the children to get saved. I’ll have to take a look at that one in the coming weeks.
Morgan Christiansson commented
Thanks for your reply.
With an upgrade to rails 2.3.11 my coworker experienced even more test failures with the state machines updated through update_attributes. I’ll post an update when I have a chance to look at it.
Thanks, Morgan
(from [31d8143969a7225926a9db034823991af38c2b2e]) Fix objects not getting marked as dirty in all integrations when #{attribute}_event is set [#69 state:resolved] https://github.com/pluginaweek/state_machine/commit/31d8143969a7225926a9db034823991af38c2b2e
Morgan Christiansson opened this issue
Like stated above.
Will try to write a testcase for it. But basically it seems .state_event_changed? doesn’t exist and .changed? doesn’t return true so update_attributes doesn’t try to save the nested models.
original LH ticket
This ticket has 0 attachment(s).