What do you call a Pokemon who likes to code?
A GEEK-achu!
Emily Giurleo • WNB.rb
*
* I didn’t write that joke
**
** This talk isn’t about Pokemon
upgrading ruby gems
what to do when
v
^
causes an error in your application
Emily Giurleo • WNB.rb
Emily Giurleo • WNB.rb
Warning: Using the last argument as keyword parameters is deprecated;
maybe ** should be added to the call
deprecation warning
you encounter when upgrading your gems, and how to fix them
Emily Giurleo • WNB.rb, March 2021
Nottabug�
The breaking change with a heart of gold
Googlit�
The one everyone knows about
Didjuread�
The one you should have known about
Brokagem�
The dependency devil
Ohshoot�
The actual bug
Emily Giurleo • WNB.rb
The one everyone knows about
Characteristics:
Strongest move:
Least effective against:
Googlit
Emily Giurleo • WNB.rb
The one you should have known about
Characteristics:
Strongest move:
Least effective against:
Didjuread
Emily Giurleo • WNB.rb
def validate(password, strict: false)
...
end
validate(‘12345’, { strict: true })
warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
ArgumentError (wrong number of arguments (given 2, expected 1; required keyword: strict))
Emily Giurleo • WNB.rb
Ruby 2.7
Ruby 3.0
You grew to Lvl 2!
New move: Google search
New move: Read deprecation warning
Emily Giurleo • WNB.rb
The dependency devil
Characteristics:
Strongest move:
Least effective against:
Brokagem
Emily Giurleo • WNB.rb
fixture_file_upload
rspec-rails
Emily Giurleo • WNB.rb
NoMethodError:
undefined method `file_fixture_path' for RSpec::Rails::FixtureFileUploadSupport
::RailsFixtureFileWrapper:Class
Did you mean? fixture_path
Wait it out
Write patch
Switch gems
Emily Giurleo • WNB.rb
You used wait it out!
Wait for gem maintainers to fix the issue and release a new version.
Most effective when:
Benefits:
Emily Giurleo • WNB.rb
You used write patch!
Make a change in your application to fix the broken gem until a new version is released.
Most effective when:
Benefits:
Emily Giurleo • WNB.rb
You used switch gems!
Switch to a different gem with the same features.
Most effective when:
Benefits:
Emily Giurleo • WNB.rb
def file_fixture_upload(path, mime_type = nil, binary = false)
...
[25 more lines of code I didn’t need]
...
Rack::Test::UploadedFile.new(path, mime_type, binary)
end
Emily Giurleo • WNB.rb
You grew to Lvl 3!
New move: Wait it out
New move: Write patch
New move: Switch gems
Emily Giurleo • WNB.rb
The breaking change (with a heart of gold)
Characteristics:
Strongest move:
Least effective against:
Nottabug
Emily Giurleo • WNB.rb
account
.contacts
.where(id: [])
.pluck(‘count(id)’, ‘sum(ask_amount)’)
#=> [[0, nil]]
Rails 6.0
#=> []
Rails 6.1
You used write issue!
Open an issue on the gem’s GitHub repository.
Most effective when:
Benefits:
Emily Giurleo • WNB.rb
Emily Giurleo • WNB.rb
You grew to Lvl 4!
New move: Write issue
Emily Giurleo • WNB.rb
The Bug
Characteristics:
Strongest move:
Least effective against:
Ohshoot
Emily Giurleo • WNB.rb
calculate_fees(1000) #=> 3500
Ruby 2.7
Emily Giurleo • WNB.rb
Ruby 3.0
calculate_fees(1000) #=> 3501
You used source dive!
Dig into a gem’s source code to find the cause of the bug.
Most effective when:
Benefits:
Emily Giurleo • WNB.rb
def calculate_fees(amount_in_dollars)
byebug
...
end
Emily Giurleo • WNB.rb
Our application
Monetize gem
Money gem
bundle open money
Emily Giurleo • WNB.rb
require 'bigdecimal/util'
num = 98.00000000000001.to_d
num.round(0, 1)
=> 0.99e2
Emily Giurleo • WNB.rb
You grew to Lvl 5!
New move: Source dive
Emily Giurleo • WNB.rb
Nottabug�
The breaking change with a heart of gold
Googlit�
The one everyone knows about
Didjuread�
The one you should have known about
Brokagem�
The dependency devil
Ohshoot�
The actual bug
Emily Giurleo • WNB.rb