Slide 1

Slide 1 text

Upgrading Rails Redux

Slide 2

Slide 2 text

Who has a Rails app in production?

Slide 3

Slide 3 text

Rails 1.x

Slide 4

Slide 4 text

Rails 2.x

Slide 5

Slide 5 text

Rails 3.x

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Porting to Rails 4 Sometimes the new code still works in old version of Rails.
 
 scope :sorted, order(“updated_at")
 
 scope :sorted, -> { order("updated_at") }

Slide 8

Slide 8 text

Porting to Rails 4 Otherwise branch?

Slide 9

Slide 9 text

Dual-boot Rails # Gemfile def rails4?
 ENV["RAILS4"] == '1'
 end RAILS4=1 rails s

Slide 10

Slide 10 text

# Gemfile
 
 if rails4?
 gem "rails", “4.0.5" # protected_attributes, etc.
 else
 gem "rails", "3.2.18"
 end Dual-boot Rails

Slide 11

Slide 11 text


 # config/environments/test.rb
 
 ActiveSupport::Deprecation.silenced = true if rails4?
 Dual-boot Rails

Slide 12

Slide 12 text

RailsDiff

Slide 13

Slide 13 text

Incremental progress • Boot Server • Run Tests (Rails 3 & 4) • Passing Tests • QA • Switch Default Rails

Slide 14

Slide 14 text

whoops • Non-digest images in emails, use public/ • Blocks iframe embedding
 response.headers.except! ‘X-Frame-Options' • Endpoints
 protect_from_forgery exceptions (CSRF)
 xml_data = Hash.from_xml(request.body.read) • Threading bug in activerecord-session_store

Slide 15

Slide 15 text

if rails_master?
 # gem "rails", :github => "rails/rails", :branch => "4-2-stable"
 gem "rails", "5.0.0.beta1"
 else
 gem "rails", "4.2.5"
 end

Slide 16

Slide 16 text

Resources • https://github.com/discourse/discourse/ blob/master/Gemfile • http://railsdiff.org/ • https://speakerdeck.com/nathany/ upgrading-rails-redux

Slide 17

Slide 17 text

Gopher Gala edmontongo.org

Slide 18

Slide 18 text

https://yng.mn/39youngman