Is it possible to create routes in Rails 4 that are only executed while the application is being run in dev mode?
Asked
Active
Viewed 1.2k times
32
-
9try throwing those routes inside of `if Rails.env.development?` statement. – jeremywoertink Oct 15 '13 at 16:09
1 Answers
66
You can test for the environment by the if statement:
if Rails.env.development?
#what you want in development
end
You can put an else statement for other environment types.
This is similar to this question: Changing a Rails route based on deployment type

Community
- 1
- 1

ChrisBarthol
- 4,871
- 2
- 21
- 24