A few slides about the migration from Rails 4 to Rails 5

A few slides about the migration from Rails 4 to Rails 5

based on github.com/netguru/reminders app

Ce277a152d715dabd06058e0ef502137?s=128

Adam Nowak

July 06, 2016
Tweet

Transcript

  1. Rails 5 is here a few slides about the migration

    from Rails ~4
  2. None
  3. my slides are not about the features - you have

    to check them out on your own!
  4. I need a TODO app for test

  5. but let’s upgrade something more useful

  6. None
  7. https://github.com/ netguru/reminders

  8. Gemfile gem "rails", "~> 4" gem "coffee-rails" gem "bootstrap-datepicker-rails" gem

    "decent_exposure" gem "draper" gem "jquery-rails", "4.0.4" # version 4.0.5 breaks jquery-datatables
  9. UPDATING!

  10. Step 1 - changing relevant gems gem "rails", "~> 4”

  11. Step 1 - changing relevant gems gem "rails", "~> 4”

    gem "rails", "~> 5"
  12. Step 1 - changing relevant gems bundle update rails

  13. None
  14. None
  15. Step 2 - updating gems along the way bundle update

    rails railties
  16. meh!

  17. Step 2 - updating gems along the way bundle update

    rails railties sass-rails
  18. nope!

  19. Step 2 - updating gems along the way bundle update

    rails railties sass-rails coffee-rails slim-rails
  20. still missing something!

  21. Step 3 - strict dependencies gem "jquery-rails", "4.0.4" # version

    4.0.5 breaks jquery-datatables
  22. Step 3 - strict dependencies gem "jquery-rails", "4.0.4" # version

    4.0.5 breaks jquery-datatables gem "jquery-rails"
  23. Step 3 - strict dependencies gem "sass-rails", "~> 5.0" 


    gem "sass-rails"
  24. Step 3 - strict dependencies bundle update rails railties sass-rails

    coffee-rails slim-rails jquery-rails
  25. None
  26. better, but still

  27. let’s have a look again

  28. None
  29. https://github.com/ evrone/quiet_assets/pull/ 51

  30. so we don’t need it anymore

  31. Step 1 - changing relevant gems gem "quiet_assets"

  32. Step 1 - changing relevant gems gem "quiet_assets" gem "quiet_assets"

  33. Step 2 - updating gems along the way bundle update

    rails railties coffee- rails slim-rails
  34. pretty good, we need to solve rspec-rails

  35. Step 2 - updating gems along the way bundle update

    rails railties coffee- rails slim-rails rspec-rails
  36. None
  37. hahahha, you fool

  38. zoom in

  39. None
  40. there should be puma here, right?

  41. Step 1 - changing relevant gems gem "thin" gem "thin"

  42. Step 2 - updating gems along the way bundle update

    rails railties coffee- rails slim-rails rspec-rails
  43. yeah

  44. step 1&2 done - our Gemfile is ok

  45. Step 3 - draper /Users/adamo/.rbenv/versions/2.2.3/lib/ ruby/gems/2.2.0/gems/draper-2.1.0/lib/ draper.rb:5:in `require': cannot load

    such file -- active_model/serializers/ xml (LoadError)
  46. It turns out, draper gem isn’t quite ready for Rails

    5
  47. It turns out, draper gem isn’t quite ready for Rails

    5
  48. I’ve used drape gem instead but you should follow https://github.com/drapergem/

    draper/pull/752
  49. Step 3 - draper gem "draper" gem "draper"

  50. Step 3 - draper bundle

  51. drape is pretty much the same as draper but you

    have to change the namespace
  52. let’s create base decorator (it should have been here before)

  53. Step 3 - draper class BaseDecorator < Drape::Decorator; end class

    ProjectDecorator < BaseDecorator
  54. awesome!

  55. Step 4 - rollbar bundle update rollbar # 2.8.0 wasn’t

    good enough
  56. push it!

  57. None
  58. webrick? it’s so <=Rails4

  59. None
  60. Step 4 - puma gem „puma" bundle

  61. None
  62. success!

  63. Step 4 - rails:update bin/rake rails:update

  64. keep going

  65. Step 4 - rspec bundle update rspec-core

  66. it turns out, you have to be strict this time

  67. Step 4 - rspec gem "rspec-rails", "~> 3.5" bundle

  68. yep!

  69. Step 5 - decent_exposure /Users/adamo/code/reminders/app/ controllers/application_controller.rb: 2:in `<class:ApplicationController>': undefined method

    `decent_configuration' for ApplicationController:Clas
  70. well, read the wiki https://github.com/hashrocket/ decent_exposure/wiki/Api-changes-in- version-3#undefined-method- decent_configuration

  71. Step 5 - decent_exposure decent_configuration do
 strategy DecentExposure::StrongParametersStrategy
 end

  72. Step 6 - rails-controller- testing 245 examples, 3 failures NoMethodError:

    assert_template has been extracted to a gem. To continue using it, add `gem 'rails-controller-testing'` to your Gemfile.
  73. Step 6 - rails-controller- testing gem „rails-controller-testing" bundle

  74. YES

  75. Step 6 - rack-mini-profiler bundle update rack-mini-profiler

  76. QL

  77. it works:)

  78. https://github.com/ netguru/reminders/pull/35

  79. –no one ever “migration will be easy”

  80. –me, now “but please do it”

  81. t.hanks! adam nowak / @lubieniebieski 06/07/2016