#1387 ✓not-applicable
Tony Pitale

Associations are not validated before trying to save, parent is created

Reported by Tony Pitale | August 12th, 2010 @ 01:30 PM

If we have a User class with many handles, generate a new user with a handle, where the user is valid and the handle is invalid, and try to save the user, #save will return false. However, the user is saved and the handle is not.

https://gist.github.com/e9b99a4ce0d49e4dc93f

Comments and changes to this ticket

  • Piotr Solnica (solnic)

    Piotr Solnica (solnic) October 24th, 2010 @ 09:32 AM

    • State changed from “unconfirmed” to “not-applicable”

    Currently DM doesn't support validation of associated objects so if the parent is valid, it will be saved. We're going to add "validates_associated" soon so you will be able to write "validates_associated :handles" which will prevent from saving entire object graph if there are invalid handles.

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 »

People watching this ticket

Pages