ruby - Trying to launch script/console using Rails 3 -


using rails 3. in project directory trying launch rails script/console using "rails console" command line & in return. loading test environment (rails 3.2.1) irb(main):001:0>

i think may confused rails commands.

rails server (or script/server when using rails 2.x) used start web server local development (this default webrick running on 0.0.0.0:3000). process runs in foreground , not allow interaction. log output stdout.

rails console (or script/console when using rails 2.x) used start interactive ruby shell (irb) rails app , environment (development default, test in case) loaded. interactive shell meaning can type ruby code in here , executed when hit return key or when encounters end of block. try out

a = ["b", "a", "r","t"] a.reverse 

will return

=> ["t", "r", "a", "b"] 

since loads rails application, have access classes defined in application. example, if have person model defined, can instantiate new instance typing following irb

person.new 

to leave irb, can type exit return operating system's shell. hope helps clear of confusion.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -