Using Rails 3. In my project directory am trying to launch rails script/console by using “rails console” command line & get this in return.
Loading test environment (Rails 3.2.1)
irb(main):001:0>
Using Rails 3. In my project directory am trying to launch rails script/console by
Share
I think you may be confused about the
railscommands.rails server(orscript/serverwhen using Rails 2.x) is used to start a web server for local development (this by default is Webrick running on0.0.0.0:3000). This process runs in the foreground and does not allow for interaction. It will log output to STDOUT.rails console(orscript/consolewhen using Rails 2.x) is used to start the interactive ruby shell (irb) with your Rails app and environment (developmentby default,testin your case) loaded. This is an interactive shell meaning that you can type ruby code in here and it will be executed when you hit the return key or when it encounters the end of a block. Try this outWill return
Since this also loads your Rails application, you have access to the classes defined in your application. For example, if you have a
Personmodel defined, you can instantiate a new instance by typing the following into irbTo leave the irb, you can type
exitto return to your operating system’s shell. I hope this helps to clear up some of the confusion.