Replaced deprecated rails 2 faulty magic with new Rails 3 magic magic.