Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

Is it Ok to use "Error" as a model name in Rails project?

Rails • Asked by Alex Musayev

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 Exception.

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 StandardError.

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 ( 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.

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.