Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change rails to development mode

In the documentation of rails (3.2.3) it says

In development mode (which is what you’re working in by default), Rails reloads your application with every browser request, so there’s no need to stop and restart the web server.

But clearly my app loads in production mode out of the box.(I can type Rails.env and see it).

Why?

I then go to environment.rb and add

ENV["RAILS_ENV"] = "development"

and still it is in production. Any idea?

Edit : Here you go

#Load the rails application
require File.expand_path('../application', __FILE__)

# Initialize the rails application
MyAppName::Application.initialize!

ENV["RAILS_ENV"] = "development"
like image 649
Bick Avatar asked May 26 '12 18:05

Bick


People also ask

How do I run rails server in developer mode?

Go to your browser and open http://localhost:3000, you will see a basic Rails app running. You can also use the alias "s" to start the server: bin/rails s . The server can be run on a different port using the -p option. The default development environment can be changed using -e .

What is Rails_env?

ENV["RAILS_ENV"] simply contains a string such as "production", "development" or "test". This tells Rails which configuration file in /config/environments to load - and which hash key in database. yml to use for the database.


2 Answers

Possible solution for your situation could be:

rails server -e development
like image 182
thesis Avatar answered Oct 12 '22 10:10

thesis


Though this is not a solution try to start the Rails server this way:

RAILS_ENV=development bundle exec rails s

What do you see if put <%= Rails.env %> somewhere in you layout file?

like image 45
Aldo 'xoen' Giambelluca Avatar answered Oct 12 '22 12:10

Aldo 'xoen' Giambelluca