Skip to content

Instantly share code, notes, and snippets.

@dbi
Created May 9, 2012 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbi/2644564 to your computer and use it in GitHub Desktop.
Save dbi/2644564 to your computer and use it in GitHub Desktop.
Sniffing for Array#to_s usage before upgrading to ruby 1.9 (where the behaviour changes)
# Log Array#to_s to make sure we are not using it and expeting the Ruby 1.8.x behaviour
class Array
alias :_to_s :to_s
def to_s(*args)
Rails.logger.warn "Was calling Array#to_s from #{caller.first.split(":in").first}"
_to_s(*args)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment