Whats wrong with this method_missing?
A coworker who shall remain nameless had this method missing implementation in a module that got mixed into the app helper. This tricked me up for longer then it should, mostly because I hadn't synced up in awhile and so assumed the problem was in changes I made. I don't know if it would break anything in production, as I never go that far - a whole bunch of failing tests stopped me before I got that far.
# gets included into ApplicationHelper, which gets included into the entire view layer, etc...
def method_missing(methodname, *args)
if methodname =~ /^render_/
methodname[/^render_/] = ''
render_ad methodname
end
end
end
Do you see whats wrong?

4 Comments