21 February 2017

Ruby on Rails | Typing Convention

Working with databases

  • Model class name is singular, starts with uppercase. e.g. class Article < ActiveRecord::Base
  • Model file name is singular, all lowercase. e.g. article.rb
  • Table name is plural of model name, all lowercase e.g. articles

Working with Buttons and Controllers

  • Controller class name is plural and written in CamelCase e.g. class ArticlesController
  • Controller file name is also plural but separated by "_" e.g articles_controller.rb

No comments:

Post a Comment