One of the most confusing causes of bugs in Rails apps is when names collide with Rails conventions.
Here’s a few places that I can think of:
- Don’t name any columns ending with
_idunless these are foreign keys and integer values. If you use the nilify_blanks gem, which is super useful when you have tables with unique indexes that allow nulls, then columns ending with
_countare ignored by default.
- Don’t name any column
type, as that’s reserved.
- Don’t accidentally create any controller methods that end in
_pathas those will conflict with route helpers.
What other names are reserved in Rails? What sort of subtle bugs have you seen related to this?