I have a simple question about class naming: is it Ok to use
Error as a model name in a Rails project?
This model will be used to persist Ruby exception objects for errors monitoring. Using
Exception as a name for this model doesn't look like a good idea, because it will collide with stdlib's
I've started using
Error for the class name, but still not sure about this. There are seem to be no class with same name anywhere in stdlib and in the gems I'm using so far. But this is still a standard suffix for most Ruby and Rails exception class names, like
Just want to be sure I'm not missing anything, like unexpected conventio-over-configuration gotchas.
Update: Errbit uses
Err for a model name with pretty much the same purposes as mine (https://github.com/errbit/errbit/blob/master/app/models/err.rb). For mysterious reason.
I think you are safe using
Error has a class/model name as it doesn't collide with stdlib in Ruby or Rails. In fact I have a similar model in one of my older apps and it never caused issues.
If it doesn't feel right, then maybe you can change it to something like
ErrorMessage or something like that, but I don't see it being an issue although others may be able to chime in with better intel.
Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.