# Is there any way to get the exception

**URL:** <https://www.ruby-forum.com/t/is-there-any-way-to-get-the-exception/144817>\
**Category:** Rails\
**Created:** [August 2, 2008, 5:16pm UTC](https://www.ruby-forum.com/t/is-there-any-way-to-get-the-exception/144817 "2008-08-02T17:16:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgreenly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85f322/32.png) [@mgreenly](https://www.ruby-forum.com/u/mgreenly)\
**Post date:** [August 2, 2008, 5:16pm UTC](https://www.ruby-forum.com/t/is-there-any-way-to-get-the-exception/144817/1 "2008-08-02T17:16:11Z")

</div>

Here is tow model:

class Morder \< ActiveRecord::Base  
has\_many :morderlists  
end

class Morderlist \< ActiveRecord::Base  
belongs\_to :morder

def validate  
#some validate  
end  
end

And the method in controller :

class MorderController \< ApplicationController  
def create  
morder=Morder.new(:code=\>‘001’)  
morderlist1=Morderlist.new  
morderlist2=Morderlist.new  
morder.morderlists \<\< [morderlist1,morderlist2]  
morder.save!  
end  
end

If the morderlist1 or morderlist2 is not correct,I just get the errors  
like 'morderlist invalid".Is there any way to get the detail  
information?

---

<div class="post-metadata">

**Author:** ![mgreenly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85f322/32.png) [@mgreenly](https://www.ruby-forum.com/u/mgreenly)\
**Post date:** [August 3, 2008, 9:48am UTC](https://www.ruby-forum.com/t/is-there-any-way-to-get-the-exception/144817/2 "2008-08-03T09:48:09Z")

</div>

On Sat, Aug 2, 2008 at 10:16 AM, Michael G.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> If the morderlist1 or morderlist2 is not correct,I just get the errors  
> like 'morderlist invalid".Is there any way to get the detail  
> information?

morderlist.errors

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)
