Class: ErrorsGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/errors_generator.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/errors_generator.rb', line 4

def setup
  route "match '/404', :to => 'errors#not_found'"
  route "match '/422', :to => 'errors#unprocessable_entity'"
  route "match '/500', :to => 'errors#internal_server_error'"

  application "config.exceptions_app = self.routes"

  copy_file 'controllers/errors_controller.rb', 'app/controllers/errors_controller.rb'
  directory 'views/errors', 'app/views/errors'
end