Class: ActionDispatch::Routing::Mapper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/dynamic_error_pages/routes.rb
Instance Method Summary collapse
Instance Method Details
#dynamic_error_pages(opts = {}) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/dynamic_error_pages/routes.rb', line 3 def dynamic_error_pages(opts={}) Rails.application.routes.draw do # rails 4 need the :via option via = Rails::VERSION::MAJOR > 3 ? {:via => :all} : {} controller = opts[:controller] || "dynamic_error_pages/errors" match '/:status', {:to => "#{controller}#show", :constraints => { :status => /\d{3}/ }}.merge(via) end end |