Tolsto
Tolsto

Reputation: 1428

Rails 4 - Specify routes exclusively for development environment

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

Upvotes: 33

Views: 12408

Answers (1)

ChrisBarthol
ChrisBarthol

Reputation: 4959

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

Upvotes: 69

Related Questions