I have mixed feelings about whether this is a good idea. If you use inherited_resources it has similar functionality built in. I’m unsure about whether inherited_resources is a good idea either though!
Find or Initialize Resource
Adds a before_filter to find or initializes resources in your Rails controllers.