Rails 6 released - What does that mean for you?
Tags: rails, webdev, ruby
Published: 2019-08-19 11:00:38

*This was originally posted on: [chrisachard.com](https://chrisachard.com/rails-6-released)*


Rails 6 was released on August 15, 2019 with a [blog post by DHH](https://weblog.rubyonrails.org/2019/8/15/Rails-6-0-final-release/)

So - what's new, and what about old Rails versions?

# Rails 4 & 5

## Support for Rails 4 is fading fast

The [official Rails maintenance policy](https://guides.rubyonrails.org/maintenance_policy.html) still lists Rails `4.2.Z` as receiving *Severe Security Issue* patches - but it's already been taking off the regular security issue patch list.

So if you're still on Rails 4 - *now is the time to start the upgrading*.

## Rails 5 is still just fine

Rails `5.0.Z` is still on the *severe* patches list, and Rails `5.2.Z` is still receiving regular security updates; so you're still OK on Rails 5 (especially `5.2` or higher)

## Stay on top of security issues

If you're concerned about keeping up to date with the latest security issues in Rails, check out the [Rails Security Policy](https://rubyonrails.org/security/) or subscribe to the [Rails Security Mailing List](https://groups.google.com/forum/#!forum/rubyonrails-security)

# How to Get the New Version

Follow these steps to get Rails 6, based on your current status:

## Make sure you have Ruby 2.5.0 or higher

Check your ruby version:

```bash
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
# Need to update!
```

If it's less than `2.5.0`, then you have to upgrade first.  I reccomend using [RVM](https://rvm.io/) for that, and you can install RVM *and* the latest Rails, all with one command:

```bash
$ \curl -sSL https://get.rvm.io | bash -s stable --rails
```

If you already have RVM installed, then you can upgrade to the latest ruby with:

```bash
$ rvm install 2.6.3 
$ rvm use 2.6.3 --default 
```

then update your gem version if needed:

```bash
$ gem update --system 
Latest version already installed. Done.
```

## Installing the latest Rails version

With Ruby >= `2.5`, you can get the latest Rails:

```bash
$ gem install rails -v '6.0.0'
Fetching concurrent-ruby-1.1.5.gem
# ...
Building native extensions. This could take a while...
# ...
40 gems installed
```

Now, check your rails version!

```bash
$ rails -v
Rails 6.0.0
```

## Making a new rails project

With Rails 6 installed, you can make a new project with:

```bash
$ rails new MyAwesomeProject
# ...
$ cd MyAwesomeProject
# ...
$ rails start
```


**NOTE**

If you run into any of the following webpacker errors:


`Webpacker configuration file not found`

OR

`Please run rails webpacker:install Error: No such file or directory @ rb_sysopen .../config/webpacker.yml`

OR

`RAILS_ENV=development environment is not defined in config/webpacker.yml, falling back to production environment`


Then you probably need to **update your `yarn` version**.  Use the [yarn docs](https://yarnpkg.com/lang/en/docs/install/#mac-stable) to upgrade, and then run:

```bash
$ rails webpacker:install
```

or delete the project and create a new one with `rails new MyAwesomeProject`

Once that all works - go to `localhost:3000` in a browser, and you're using the new version of Rails!

![Running Rails](https://thepracticaldev.s3.amazonaws.com/i/4tdrv2qldk50wx3blwaj.png)


## Upgrading existing projects

If you have a Rails project on `5.2`, then you can update with the `rails app:update` command:

```bash
$ rails app:update
```

or for Rails `4.2` or lower, you can use the `rake` version of the same task:

```bash
$ rake rails:update
```

For much more technical details about what to expect when upgrading, check out the [official Rails upgrade docs](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html).



# What's New and Exciting

Ok - you have Rails 6 now... what is new and interesting!?

## Webpacker by default

I love mixing React into Rails projects and webpacker is *often* the best choice for adding npm dependencies into Rails projects.  

Now you don't have to worry about the best way to set it all up - because webpacker is built in! 

## Built in rich text editor

The [Trix editor](https://trix-editor.org/) is a rich text editor made by Basecamp.  With Rails 6, it's included automatically as [Action Text](https://github.com/rails/rails/tree/6-0-stable/actiontext). 

To get it working, check out the [Action Text Overview](https://guides.rubyonrails.org/action_text_overview.html), or [this video by DHH](https://www.youtube.com/watch?v=HJZ9TnKrt7Q) which walks you through setting it up.

![Trix Editor](https://thepracticaldev.s3.amazonaws.com/i/1b1sp90lpjwz5v4ekfct.png)

## Running tests in parallel

WooHoo!  

If you've worked on any large Rails projects before - then you know how long it can take to run some test suites.

Now - there is finally a built in way to [parallelize your tests](https://guides.rubyonrails.org/testing.html#parallel-testing).

## Loads of other little improvements

For a complete list of all the changes, you can view the changelogs of each individual part of Rails:

[Action Cable](https://github.com/rails/rails/blob/v6.0.0/actioncable/CHANGELOG.md), 
[Action Mailer](https://github.com/rails/rails/blob/v6.0.0/actionmailer/CHANGELOG.md), 
[Action Pack](https://github.com/rails/rails/blob/v6.0.0/actionpack/CHANGELOG.md), 
[Action View](https://github.com/rails/rails/blob/v6.0.0/actionview/CHANGELOG.md), 
[Active Job](https://github.com/rails/rails/blob/v6.0.0/activejob/CHANGELOG.md), 
[Active Model](https://github.com/rails/rails/blob/v6.0.0/activemodel/CHANGELOG.md), 
[Active Record](https://github.com/rails/rails/blob/v6.0.0/activerecord/CHANGELOG.md), 
[Active Storage](https://github.com/rails/rails/blob/v6.0.0/activestorage/CHANGELOG.md), 
[Active Support](https://github.com/rails/rails/blob/v6.0.0/activesupport/CHANGELOG.md), and 
[Railties](https://github.com/rails/rails/blob/v6.0.0/railties/CHANGELOG.md)


# Should you use Rails 6?

If you are starting a **new Rails** project today - I would *definitely* start with Rails 6.  It's officially supported now - and if you look at some of the CHANGELOGS above, you'll see that many of the subsystems have been stable for many months.

If you have a project on **Rails 5.2 or higher** - then you have some time before you have to do anything.  If you're not interested in any of the [major announced updates](https://weblog.rubyonrails.org/2019/8/15/Rails-6-0-final-release/) then you'll still be getting security updates for awhile.  

You could still try running `rails app:update` though, just to see how much has changed for you particular app - which will give you an idea of how much work it will be when you do decide to upgrade.

If you have a project on **Rails 5.0 or lower** - then I would definitely consider upgrading sooner rather than later.  It will take more work to upgrade these older projects (especially Rails 4 and below) - but security updates are already stopped for Rails < 4.2 - so now (right after a major release) is a good time to update (so that you don't have to do it again for awhile).

# So what am I going to try first?

I showed how to make `MyAwesomeProject` above, so I'm going to take this chance to try out [Action Text](https://github.com/rails/rails/tree/6-0-stable/actiontext) - the built in rich text editor looks awesome and easy to use.

Once I get that working, I'll post an article about it - so [join my newsletter](https://chrisachard.com) to hear about that in the future!