I'd like to create a scope in my routes.rb file to only route certain URLs when in the production environment. How do you use conditionals with Rails 3 routing? All开发者_开发百科 I need to do is restrict those rules based on Rails.env.production?
being true, but I'm not sure of the syntax.
routes.rb
is Ruby file so this should work:
if Rails.env.production?
get "/bar" => 'welcome#index'
else
get "/foo" => 'welcome#index'
end
精彩评论