Created
November 14, 2008 21:52
-
-
Save trevorturk/25108 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'etc' | |
class Group | |
def foo | |
"hello" | |
end | |
end | |
class WTF < Struct.new(:var) | |
def foo | |
puts Group.new.foo | |
end | |
end | |
puts Group.new.foo | |
WTF.new.foo | |
### OUTPUT ### | |
# NoMethodError: undefined method ‘foo’ for #<struct Struct::Group name=nil, passwd=nil, gid=nil, mem=nil> | |
# | |
# So... when you require 'etc' you get a Struct::Group and Struct::Passwd | |
# | |
# For Rails apps, the offender is in rails/railties/lib/rails/mongrel_server | |
# ... which requires 'etc' | |
# http://www.ruby-doc.org/stdlib/libdoc/etc/rdoc/classes/Etc.html | |
# | |
# Awesome! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment