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