# Raise Exception in Non Active Record Model

**URL:** <https://www.ruby-forum.com/t/raise-exception-in-non-active-record-model/184707>\
**Category:** Rails\
**Created:** [March 7, 2010, 3:50am UTC](https://www.ruby-forum.com/t/raise-exception-in-non-active-record-model/184707 "2010-03-07T03:50:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smarter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9fc29f/32.png) [@smarter](https://www.ruby-forum.com/u/smarter)\
**Post date:** [March 7, 2010, 3:50am UTC](https://www.ruby-forum.com/t/raise-exception-in-non-active-record-model/184707/1 "2010-03-07T03:50:18Z")

</div>

Hi There:

If I raise an exception in a Non Active Record Model object on call from  
Controller that extends from ApplicationController, what are the best  
ways to show it on the view side as an error?

Thanks much.

---

<div class="post-metadata">

**Author:** ![smarter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9fc29f/32.png) [@smarter](https://www.ruby-forum.com/u/smarter)\
**Post date:** [March 7, 2010, 4:02am UTC](https://www.ruby-forum.com/t/raise-exception-in-non-active-record-model/184707/2 "2010-03-07T04:02:57Z")

</div>

Smart RoR wrote:

> Hi There:
> 
> If I raise an exception in a Non Active Record Model object on call from  
> Controller that extends from ApplicationController, what are the best  
> ways to show it on the view side as an error?
> 
> Thanks much.

I raise exception in Non Active Record Model.  
I then have in Controller  
begin  
@some\_var=NonActiveRecordModel.find\_by\_something  
rescue =\> e  
raise e  
end

But the exception doesn’t reach the Controller from the Non Active  
Record Model?  
Something missing here.

---

<div class="post-metadata">

**Author:** ![smarter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9fc29f/32.png) [@smarter](https://www.ruby-forum.com/u/smarter)\
**Post date:** [March 7, 2010, 8:30am UTC](https://www.ruby-forum.com/t/raise-exception-in-non-active-record-model/184707/3 "2010-03-07T08:30:42Z")

</div>

Seems Controller Exception Handling kicks in as usual.  
Wanted to avoid as this is part of JS AJAX request.
