Don't use flash for a controller method name
While working on a Flash developers page for the Chumby website, I kept getting this error:
Error in DevelopersController#flash
You have a nil object when you didn't expect it!
The error occured while evaluating nil.sweep
Pretty puzzling at first. The method was empty, so what could be wrong here?
class DevelopersController < ApplicationController
def flash
end
end
Eventually... it hit me! ActionController has its own flash method which is used to display flash notices and warnings.
But, in this case, I was making a page about Adobe Flash, so I was running over a reserved word for controller method names. Kinda obvious, once you think about it.
What's the workaround? Well... if you really need your page to be named "flash" (and I did), just remove the method from your controller. As long as you have a template named flash.rhtml, the page will still load.
New comments are disabled right now. Once we finish migrating this blog, we'll restore them.
