All threads / How do i wrap calls to update_attributes via transaction?
Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do i wrap calls to update_attributes via transaction?

Arul asked in Rails

I have two models User/Car. User can have many Cars. How do i prevent updates to cars if my user object is invalid? Currently Rails does not wrap the attribute update(cars) in a same transaction as user.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 64,380+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.