Catching an error for a child resource in Ruby on Rails
Posted
by randombits
on Stack Overflow
See other posts from Stack Overflow
or by randombits
Published on 2010-04-20T01:40:16Z
Indexed on
2010/04/20
1:43 UTC
Read the original article
Hit count: 257
ruby-on-rails
|activerecord
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?
© Stack Overflow or respective owner