💎 Ruby on Rails
Beginner
What is a Rails generator?
Answer
Rails generators are command-line tools that scaffold code files automatically, following conventions. Common generators: rails generate model User name:string email:string creates a model and migration; rails generate controller Pages home about creates a controller with actions and views; rails generate scaffold Post title:string body:text generates the full CRUD stack (model, migration, controller, views, routes). Generators save time and ensure consistent file structure. You can also create custom generators.