# Prerequisites
### Verify latest Ruby version
[Ruby downloads](https://www.ruby-lang.org/en/downloads/)
### Check local Ruby version (CLI)
```
$ ruby -v
```
### If necessary, upgrade Ruby (CLI)
```
$ rvm get stable
$ rvm install ruby-3.0.2
```
### Check Rails version (CLI)
```
$ rails -v
$ gem list rails --remote -e
```
### If necessary, upgrade Rails (CLI)
```
$ gem update rails
```
#### For a specific Rails version
* See all Rails versions: https://rubygems.org/gems/rails/versions
* Install a specific Rails version: `gem install rails -v 5.2.5`
---

# Default (rspec, postgres, haml)
### CLI
```
$ rails new my-app --skip-bundle -T --database=postgresql
```
### Gemfile
```
# Use haml instead of erb
gem 'haml-rails'

group :development, :test do
  # Use rspec instead of minitest
  gem 'rspec-rails'
end
```

[Read Ruby version from file](https://andycroll.com/ruby/read-ruby-version-in-your-gemfile/)
```
ruby file: ".ruby-version"
```

### CLI
```
$ bundle install
$ rails haml:erb2haml
$ rails g rspec:install
$ rails webpacker:install
$ git add .
$ git commit -m "Initial commit"
$ rails db:create
$ rails s
```
---

# Basic
```
$ rails new my-app
```

# With rspec (no tests)
```
$ rails new my-app -T
# gem 'rspec-rails'
$ bundle install
$ rails g rspec:install
```

# With postgres
```
$ rails new my-app --database=postgresql
```

# With mongodb
https://gist.github.com/randallreedjr/bfe8e752fb992dba16b5318dbea1e443

# With no database
```
# Rails 5
$ rails new my-app --skip-active-record
# Rails 4
$ rails new my-app --skip-activerecord
```

# API only
```
$ rails new my-app --api
```