# As part of blog post "Detect clashing named routed early in rails" # http://blog.peelmeagrape.net/2009/3/12/detect-clashing-named-routes-early-in-rails module IGOpeople module Routing module BorkOnNamedRouteClash def self.included(base) base.alias_method_chain(:add_named_route, :checking_clash) if ['development','test'].include?(RAILS_ENV) end def add_named_route_with_checking_clash(name, path, options = {}) raise('clashing named route: '+ name.to_s) unless named_routes[name.to_sym].nil? add_named_route_without_checking_clash(name,path,options) end end end end ActionController::Routing::RouteSet.send :include, IGOpeople::Routing::BorkOnNamedRouteClash