Forum: Rails Engines App vs Engine - raise error message

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Wes Hays (Guest)
on 2007-03-27 10:05
(Received via mailing list)
I have some code that I was duplicating across applications so I made it
an engine. The engine works fine but the only problem is when I raise an
error in the before_destroy method in my model (the model is not in the

Based on the example code below; if I have this code in a controller
that is not in a engine I will get the following error:

"Fee type is in use"

Which is exactly what I want.  However, if I have that exact same code
in my engine I get the full path to the file that raised the error plus
the error message "Fee type is in use".

`before_destroy': Fee type is in use"

I cannot figure out how to only get the error message without the other
stuff (path and method) as this could be a possible security risk.

I have tried the different options for the raise method but with no

I am using Ruby 1.8.5 and Rails version 1.2.3.
The following sample code is what's in question.

*** Model ***


 has_many :ga_locations

def before_destroy
  raise 'Fee type is in use' if self.ga_locations.count > 0


*** Controller ***


rescue Exception => err
  flash[:error] = err.message



Any help on this would be appreciated.


James "Wes" Hays
Great Basin Development
P.O.Box 3503, Reno, Nevada 89505
This topic is locked and can not be replied to.