Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restrict routes by environment

We (me and all my personalities, of course) have several routes we'd like to not expose in production but we use in development and testing. I know you can (or could?) add a before filter in the controller to lock down these things depending upon environment, but can this be done from config/routes.rb?

thanks

like image 329
jaydel Avatar asked Aug 29 '11 16:08

jaydel


1 Answers

Have you tried:

if Rails.env.development?
   resources :secrets
end

As I understand the router, that should work.

like image 142
Andrew Avatar answered Sep 17 '22 23:09

Andrew