“Rails generate” what?

rails new my_app
  • migration: migration only
  • model: migration + model
  • controller: controller + a views folder
  • resource: migration, model, controller, routes
  • scaffold_controller: controller + views
  • scaffold: migration, model, control, route, views, and many other things
  • Model generator gets used regularly, it creates a model and associated database table.
  • Controller generators are great for creating static views or non-CRUD related features. Note if you use “rails g controller student”, it actually create controller in singular form. student_controller, as vs. to students_controller in controllers generated by other generators.
rails g resource Account title room_number:integer --no-test-framework --no-helper --no-stylesheets --no-assets --no-test-framework
rails new plumber --skip-test
rails generate scaffold cello --no-helper --no-jbuilder --no-api --no-asset --no-scaffold-stylesheet --no-stylesheets
rails_naked_scaffold.sh cello
rails g scaffold_controller User name email
rails g scaffold_controller User User.column_names.join(" ")As 2.6.1 :002 > User.column_names.join(" ")=> "id name created_at updated_at"




Full-stack FHIR Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How much information is too much information?

Coding Stories: Random Experiences

Difference- VPS Versus Dedicated Hosting Versus Cloud Hosting

How I got a Golden Badge on Stack Overflow with Bot Automation.

Data Hub Architecture in AWS

How can we use Envoy & Consul to route & register micro-services?

Fedi — Flutter open-source social network client. Part 3. Build & Config.

Taking a first look at Google Cloud Architecture Diagramming Tool

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chloe Liu

Chloe Liu

Full-stack FHIR Developer

More from Medium

We met in the spring.

Severe Intel Blunders, Obama’s Terrible Brain Fart Compounded By White Analysts in Langley And Use…

Flsun Q5 - Install Klipper and Fluidd

CS371p & CS373 Spring 2022: Aimery Methena