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.

NounSingular?Plural?Example
ControllerNoYesusers_controller
products_controller
ModelYesNouser.rb
product.rb
ViewNoYes/users
/products
RoutesNoYesresources :users, :products
Migrations / Table NameNoYes001_create_users.rb
Seed DataNoYesseeds.rb

Resources

unsplash-logoKumiko SHIMIZU

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.