Raise Exception in Non Active Record Model

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.

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.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs