This project is archived and is in readonly mode.

#3638 ✓resolved
Matt Swasey

Different nested validations should not be ignored

Reported by Matt Swasey | December 30th, 2009 @ 04:40 PM | in 3.0.2

This is my first ticket, be nice please.

Given the following relationship.

class Store < ActiveRecord::Base
  has_many :products
  accepts_nested_attributes_for :products

class Product < ActiveRecord::Base
  belongs_to :store
  validates_presence_of :name

If I create two nested products on a parent store, both invalid, I will only get one validation error, observe:

s = => nil) => nil)

=> ["Products name can't be blank"]

I'm not sure if this is a bug, or just something that was never considered an issue. I assume the attribute (:name in this case) is overwriting the previous one, resulting in one error.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket

Referenced by