Approximity blog home
1 of 1 article InfoSyndicate: full/short

script/console -- the rails irb   14 Nov 05
[print link all ]
Few rails users know that script/console exists. It lets you interactively explore your rails application. It is quiet similar to irb.

It can help to avoid a lot of browser reloads and so ultimately speed up developmpent even further. It’s a great debugging tool, and it’s fun to play with your objects in real time. But even better; you can use it to get work done. You have full access to your models.

 >> u=User.find_by_username('m94asr')
 => #<User:0x23b34b0 @attributes={"username"=>"m94asr",
   "firstname"=>"Armin", "id"=>"1", "surname"=>"Roehrl", "password"=>"XX"}>

 #reload your code
 load 'sample.rb'
 sample.do_sth

Start the console with the console script:

 ruby script/console

If you start it without arguments the script will start the console in the development environment. To get to the production DB type

 ruby script/console production

 

Powered by Rublog