rails
TLDR
Create a new Rails application
SYNOPSIS
rails command [options] [arguments]
DESCRIPTION
rails is the command-line interface for the Ruby on Rails web application framework. It provides tools for creating, developing, and managing Rails applications through a unified interface.
The command operates in two contexts: outside an application (primarily rails new for creating projects) and inside an application directory (all other commands). Within a project, commands are typically invoked via bin/rails to ensure the correct bundled version is used.
Rails emphasizes convention over configuration, and its CLI reflects this by providing generators that create boilerplate code following Rails conventions. The framework integrates database management, testing, asset compilation, and server operation into cohesive command-line workflows.
PARAMETERS
new appname_
Create a new Rails application with standard directory structureserver, s
Start the Puma web server (default port 3000)console, c
Open an interactive IRB session with the application contextgenerate, g
Run code generators for models, controllers, migrations, etc.destroy, d
Remove files created by a generatordb:migrate
Run pending database migrationsdb:create
Create the databasedb:seed
Load seed data from db/seeds.rbdb:setup
Create database, load schema, and seed dataroutes
Display all defined routestest
Run the test suite--help, -h
Display help for any command--version
Show the Rails version-e, --environment ENV
Specify environment (development, test, production)-p, --port PORT
Set server port (default 3000)
CAVEATS
Most commands must be run from within a Rails application directory. The rails new command is the exception and creates that directory structure.
Generated code should be reviewed before use. Generators create standard patterns that may need customization for specific requirements.
Database commands require proper database configuration in config/database.yml and the appropriate database adapter gem.
HISTORY
Rails was created by David Heinemeier Hansson and extracted from the Basecamp project management tool in 2004. The first public release was version 1.0 in December 2005. The framework popularized the MVC pattern for web development and introduced conventions like RESTful routing that influenced many subsequent frameworks.


