removing duplicate code in railties/lib/rails/generators/resource_helpers.rb