How to upgrade to Rails 5

1. Deciding to upgrade

DHH Introducing Rails 5 features at RailsConf 2015

2. Studying what’s new and changed

2. Preparing to upgrade

4. The actual upgrade

  1. Initially, I’ve disabled “belongs_to required by default” feature (see “Bringing in new features” later in this post)
# config/initializers/active_record_belongs_to_required_by_default.rbRails.application.config.active_record.belongs_to_required_by_default = false
# config/initializers/callback_terminator.rbActiveSupport.halt_callback_chains_on_return_false = true
  1. Sprockets 4 manifest
  1. I’ve enabled back “belongs_to required by default” feature (see above) and cleaned up validations. You no longer need to explicitly validate “presence” of the associated object.
  2. I’ve disabled ActiveRecord’s “halting callback chains” feature (see above), revised that no callbacks relied on halting with a boolean flag and instead raised ActiveRecord::Rollback where it was appropriate.
  3. I’ve also brought in the has_secure_token and got rid of our own Concern that was responsible for generating application tokens.

5. Wrapping up

--

--

Founding engineer @_buildspace 🦄 Made: @snipyio @getslashdeploy Prev: @Groove , @Dockbit & Deveo Helping devs to get into Web3, one block at a time 🚀

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

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
Tair Asim

Tair Asim

399 Followers

Founding engineer @_buildspace 🦄 Made: @snipyio @getslashdeploy Prev: @Groove , @Dockbit & Deveo Helping devs to get into Web3, one block at a time 🚀