Class: SimpleErrorsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- SimpleErrorsGenerator
- Defined in:
- lib/generators/simple_errors/simple_errors_generator.rb
Instance Method Summary collapse
- #copy_error_pages ⇒ Object
- #copy_layout ⇒ Object
- #include_simple_errors ⇒ Object
- #remove_default_files ⇒ Object
Instance Method Details
#copy_error_pages ⇒ Object
8 9 10 11 12 |
# File 'lib/generators/simple_errors/simple_errors_generator.rb', line 8 def copy_error_pages %w(404.html.erb 500.html.erb).each do |file| copy_file file, "app/views/errors/#{file}" end end |
#copy_layout ⇒ Object
4 5 6 |
# File 'lib/generators/simple_errors/simple_errors_generator.rb', line 4 def copy_layout copy_file "error.html.erb", "app/views/layouts/error.html.erb" end |
#include_simple_errors ⇒ Object
14 15 16 17 18 19 |
# File 'lib/generators/simple_errors/simple_errors_generator.rb', line 14 def include_simple_errors inject_into_file 'app/controllers/application_controller.rb', after: "class ApplicationController < ActionController::Base\n" do <<-RUBY include SimpleErrors::Rescue RUBY end end |
#remove_default_files ⇒ Object
21 22 23 24 |
# File 'lib/generators/simple_errors/simple_errors_generator.rb', line 21 def remove_default_files remove_file 'public/404.html' remove_file 'public/500.html' end |