Catching an error for a child resource in Ruby on Rails
- by randombits
What is the best way to add errors to render if a child resource is really what's having issues and not the parent resource? In english what I mean is the following.. imagine the following code:
@foo = Foo.new
foochild = Foochild.new
// break foochild somehow
@foo << foochild
@foo.save
now when I do:
format.xml { render :xml => @foo.errors }
I don't get anything about how foochild broke, meaning the error message is useless to the user.
How does one go about fixing this?