errbit icon indicating copy to clipboard operation
errbit copied to clipboard

Upgrade rails to 5.0

Open biow0lf opened this issue 3 years ago • 3 comments
trafficstars

Aloha!

Main change: Upgrade Ruby on Rails to 5.0

Changes:

  1. Update rubygems to 3.3.19
  2. Update bundler to 2.3.19
  3. Add activemodel-serializers-xml gem. This functionality was removed from rails 5.0. We use it .to_xml.
  4. mongoid was updated to 6.0.3. This is latest version that works with rails 5.0.
  5. yajl-ruby gem was removed without replacement. If we need more speed, we can look at oj gem and ox gem for xml parsing.
  6. Add rails-controller-testing gem. Required by rspec.
  7. rails_12factor gem removed without replacement. All functionality was merged in rails itself.
  8. Some gems were updated. Commit by commit. Before rails upgrade.
  9. .with(consistency: :strong) was removed. mongoid gem deprecate them and remove support. We can use replacement to read from main mongo db. Did we really need this?
  10. Replace render text: with render body:.
  11. Remove ActionController::RedirectBackError. This exception deprecated.
  12. Replace update_attributes with just update. update_attributes is just long alias to update.
  13. redirect_to :back was replaced with redirect_back fallback_location: root_path
  14. Watcher#user should be explicitly marked as optional.
  15. autotest/discover.rb was removed without replacement. I think, this is ancient relict.
  16. Rails files was synced with rails 5.0.
  17. Add empty public/apple-touch-icon-precomposed.png to reduce error logs.
  18. Add empty public/apple-touch-icon.png to reduce error logs.
  19. Fix rails deprecations with positional arguments in tests. Like: before get :show, id: app.id and after get :show, params: { id: app.id }.
  20. Rails 5.0 more strict about status code. You can't use :error. You should exactly code like :internal_server_error.
  21. Rails rename serve_static_files to public_file_server.enabled. I left env name Errbit::Config.serve_static_assets.
  22. Rails configs were synced with rails defaults. With comments and other stuff inside.
  23. Sync public/404.html, public/422.html and public/500.html with rails 5.0.
  24. Remove monkey-patch from spec/spec_helper.rb
  25. Fix deprecation in add_on_blank(:resolved)
  26. Fix spec/requests/health_controller_spec.rb

Ok, it's time to talk about broken mongoid. Link to issue. Test suite pass, so.

I left:

# TODO: uncomment with new mongoid 6.2.x or later
# app.watchers.build(email: '[email protected]')
# app.save

with rails 5.1 should work properly.

P.S.: Running test suite generates a lot of warnings. This is not good, but... We can fix them later. :)

P.S.2: I update Dockerfile. And build image here.

biow0lf avatar Jul 30 '22 01:07 biow0lf

@stevecrozz it is time to ask about code review.

A lot of deprecations. But, anyway, it's time to show and ask feedback.

I recommend to review this PR by commits. One commit per a time.

biow0lf avatar Jul 31 '22 22:07 biow0lf

Next update will be with fixes for deprecations and upgrade omniauth and related gems.

biow0lf avatar Aug 12 '22 19:08 biow0lf

Looks pretty good to me @biow0lf . Are you ready?

stevecrozz avatar Aug 12 '22 21:08 stevecrozz

@stevecrozz I am ready. Let's merge and see.

biow0lf avatar Aug 22 '22 20:08 biow0lf

🎉

stevecrozz avatar Aug 22 '22 21:08 stevecrozz