Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typus route order

It used to be that you could load Typus routes exactly where you needed them by placing

  Typus::Routes.draw(map)

at the appropriate point in your routes.rb file. It seems that this is no longer supported and that they're always loaded after all of the application routes. This causes problems with catchall routes which must be defined last. Does anyone know how to control the load order for typus now? Is there a way to get them defined before any of the app routes rather than after? Thanks!

like image 319
njorden Avatar asked Apr 18 '26 05:04

njorden


1 Answers

I got around it by leaving my catch-all routes at the end of my apps routes.rb BUT excluding it from matching for Typus urls:

# A catch all route
match '*path' => 'content#show', :constraints => lambda{|request|
  !request.path.starts_with?("/admin") # excluded if typus will be taking it...
}

This may or may now work for you...

like image 101
adzdavies Avatar answered Apr 20 '26 18:04

adzdavies



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!