Ruby on Rails (Rails) is good at doing the manual work for you. With one line, Rails can create the model, controller and view files associated with your application. The downside of using
rails generate or its shortcut
rails g is that small mistakes like typos are amplified. If Rails is expecting
user, and you mistakenly typed
users it could cause functionality errors.
This cheat sheet will help to avoid those conflicts.
If you are comfortable working with Rails, Model–view–controller (MVC) architecture
rails generate, this post is for you.
|Migrations / Tables||No||Yes||001_create_users.rb, 002_create_products.rb|
|Scaffold||Yes||No||rails g scaffold user|
The above chart was updated on February 15th 2020 to include scaffolds. Thank you timnans for the suggestion! The table was also put into alphabetical order by noun.
The post Singular or Plural? A Cheatsheet for Ruby on Rails Generators appeared first on Shannon Crabill — Software Engineer && Email Developer.