I have some code that I was duplicating across applications so I made it a plugin (engine actually). 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 engine).
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".
"/Users/weshays/temp/myapp/config/../app/models/fee_type.rb:6:in `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 luck.
I am using Ruby 1.8.5 and Rails version 1.2.3.
The following sample code is what's in question.