Code naming conventions used on the site (for editors)
Last edited 5 months ago — Added 5 months ago

AntCat's code is written in the Ruby programming language, using the framework Ruby on Rails (or just "Rails").

Nerdy words often appear in code blocks, like Name, names and, to make it easier to see what kind of "name" that is being referred to.

Rails conventions
What Format Example
Database table names Plural, lower case, words separated by underscores taxon_history_items
Database column/field names Often prefixed with the table name; "column" and "field" can generally be used interchangeably taxon_id or taxon_history_items.taxon_id
Rails models Singular, first letters in words capitalized, no spaces TaxonHistoryItem

Database vs. Rails models

The database can be said to be more "stupid": it often knows how tables and columns are connected to other tables and columns via foreign keys (this is however not always the case), but it knows less about the domain model.

Rails models usually map 1-to-1 to a database table with the pluralized name of the model. They are responsible most domain knowledge, for example which Taxon statuses (column taxa.status) are required to have a "Current valid name" (taxa.current_taxon_taxon_id.)