Upgrade to Rails 4.1 #585
Description
With 19 security risks according to Gemnasium, updating to the newest stable version of Rails (4.1) seems imperative. While absent in client negotiations, this should be a top priority after 3.3.0.
The good news is that by all counts, the process is not nearly as strenuous as the Rails 2 -> Rails 3 update.
Resources
- Andy Lindeman has released his Upgrading to Rails 4 book as open-source; it seems quite comprehensive and well-acclaimed.
- The official RoR guide to upgrading
Preparation
Ruby >= 1.9.3
Upgrade to Rails 4 is possible on our current Ruby version; after #535 is merged into development, we should be golden.
Testing coverage
All guides concur that testing coverage should be as complete as possible. This means that #403, #404, #416 and #577 should be prerequisites for the upgrade.
Gems
According to [http://www.ready4rails4.net/gemfile_check/new], only CanCan is definitely not ready for Rails 4 (as of 4 months ago); the status of rdoc, rubycas-client-rails, net-ldap, permanent_records, jquery_datepicker, spinjs-rails, fuubar, yajl-ruby, pry-stack_explorer, pry-remote, and letter_opener_web is unknown to the site. That said, CanCan has been continued as CanCanCan and should be backwards-compatible; also, the latest CanCan version reportedly works if StrongParameters are not used and the protected_attributes gem is installed (which is what we should do at the start, anyway).
Tools
- rails4-upgrade gem by Andy Lindeman should be helpful.
Relevant Changes / Deprecations
Relevant as in "Reservations uses some of the features that are newly deprecated".
Relevant and action required
- Models:
attr_*
extracted into the (protected_attributes gem)[https://github.com/rails/protected_attributes]; the suggested default now is Strong Parameters, although the two reportedly don't mix well. - Routes:
match
with unspecifiedvia:
is no longer supported. We have at least four such routes.
Relevant and won't affect us
- Recommended use of PATCH instead of PUT verb
.update_attributes
->.update
- Scopes should now take lambda/proc as second argument
Relevant for the future
- The new mechanics of
.includes(:resource)
will be useful to know for addressing speed concerns / N+1 queries in Speed-testing #574. - turbolinks will probably break our JS, unless we take care to prevent it (i.e. install jquery.turbolinks?)
:controller/(de)?activate
will now be able to be refactored into a route concern
Unaddressed in this post
- Investigations of all gems
- Necessary config changes
- Deployment issues
Activity