Skip to content

Instantly share code, notes, and snippets.

@burke
Created February 2, 2010 21:37
Show Gist options
  • Save burke/293060 to your computer and use it in GitHub Desktop.
Save burke/293060 to your computer and use it in GitHub Desktop.
class MyModel < ActiveRecord::Base
def self.find_by_name(*args)
super(*args) || raise(ActiveRecord::RecordNotFound)
# What happens here is that occasionally (always, with rspec), super(*args) causes
# the method to return nil immediately, and not evaluate anything else in the method body.
# We've even tried:
# super(*args)
# raise StandardError
# and rspec still just gets nil.
# Halp?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment