32

Is it possible to create routes in Rails 4 that are only executed while the application is being run in dev mode?

Tolsto
  • 1,418
  • 2
  • 17
  • 45

1 Answers1

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