Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. module RouteSpy
  2. def matches?(request)
  3. if response = super(request)
  4. File.open(Rails.root.join('tmp', 'default_route.txt').to_s, 'a') do |file|
  5. file.write(request.inspect)
  6. end
  7. response
  8. else
  9. false
  10. end
  11. end
  12. end
  13.  
  14. default_route = Rails.application.routes.set.detect do |route|
  15. route.ast.to_s == '/:controller(/:action(/:id))(.:format)'
  16. end
  17. default_route.singleton_class.prepend(RouteSpy)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement