Last update – 2006-05-30
Ruby on Rails praises convention over configuration. Nice, but You have to be aware of this conventions, or You may run into troubles. Let’s take DB column names. RoR makes many assumptions about them, allowing this way many magic things happen.
Currently I’m aware of following conventions:
- column id is reserved for table primary index
- suffix _at for datetime fields
- suffix _on for date field
- suffix _id for reference to other table
- column type single table inheritance (see: RoR Wiki)
- dont use sessions table in DB (or don’t use code generated by scaffold) details explained https://nhw.pl/wp/2006/05/30/dont-use-sessions-table-in-rails
I was not aware about type column, and doing application for import scan results from Nessus I ran on following error:
SyntaxError ((eval):1:in `compute_type': compile error (eval):1: parse error, unexpected tINTEGER Object::0
It was caused by type column, since DB structure was tailored to match Nessus export to SQL file, which was using such a column.
Columns named created_on and updated_at are automagically set for record creation date and update time respectively
If a hosting company offers website design templates in addition to domain registration, the worth of its dedicated servers increases overnight.
Leave a Reply