class SimpleErrorsGenerator

Public Instance Methods

copy_error_pages() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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