The ‘activerecord-session_store’ gem provides support for those storing sessions in the database. My app stores sessions in cookies, so I removed that gem from my Gemfile. That said, Rails 4 introduces an encrypted cookie store, which I want to use. The first thing I had to do was edit config/initializers/session_store.rb and change this:
1 2 3 4
1 2 3 4
Then I ran:
Finally, I edited config/intializers/secret_token.rb and added a config for secret_key_base, using the hash that I had just generated. Note, leave the secret_token config alone.
Another one down! We’re in the home stretch as the rest of the backward compatability gems you’re probably not using.
The ‘rails-observers’ gem allows Rails 4 apps to still use Observers, which have been phased out. I don’t use observers in this app, so I can safely remove this gem. For those using observers, the recommendation is to move your observed code into model callbacks (i.e., after_save)
Next up was the ‘actionview-encoded_mail_to’ gem. This provides backward compatability for those who used the “encode” option when using the “mail_to” helper. I never did that, and I bet you didn’t either, which is why the functionality was removed from Rails 4 and extracted to this gem. Remove the gem — another one down!
Next up was the ‘rails-perftest’ gem. Performance tests were removed from Rails 4 and extracted to this gem. If you don’t need them, you don’t need this gem. Remove it and move on. Another one down!
Finally, the ‘actionpack-xml_parser’ gem simply extracted XML parsing into its own gem. Again, my app didn’t need this, so I removed the gem.
Woo! All backward compatability gems have been addressed. I’ve converted all of my code and have removed all of them, including the ‘rails4_upgrade’ gem.
That’s it. I’m officially running a Rail4 upgraded app!