makandra / active_type

Make any Ruby object quack like ActiveRecord
MIT License
1.09k stars 74 forks source link

Partial rollback with two nested attributes #84

Closed kdiogenes closed 6 years ago

kdiogenes commented 7 years ago

Giving this class:

class Event::LandingPageForm < ActiveType::Object
  nests_one :user
  nests_one :event
end

And this Event class:

class Edition < ApplicationRecord
  after_create :method_raising_exception

  private

  def method_raising_exception
    raise 'rollback only edition'
  end
end

When I call save in an instance of Event::LandingPageForm, only the event is rolled back. The expected behavior is to have everything rolled back, right?

kdiogenes commented 7 years ago

I forgot to say, I'm using activerecord-5.1.0.rc2

triskweline commented 7 years ago

Yes, the whole save to LandingPageForm and all its nested records should be rolled back.

We haven't tested ActiveType against ActiveRecord 5.1 yet.

Does this behavior occur with activerecord 5.1.1?

kdiogenes commented 7 years ago

I will try to update my application ASAP and give a feedback.

kdiogenes commented 6 years ago

Sorry for the long time, btw I can't reproduce the bug anymore in ActiveRecord 5.1.4, so I'm closing this, thanks!