Special Variables:
app
helper
Specifying console environment (defaults to development):
$ script/console production
$ script/console test
$ script/console development
Loading a session for debugging:
>> session =
Marshal.load(File.open(’tmp/sessions/ruby_sess.8eb9614a7e4e1e3b’))
=> {”hash”=>{:cart=…
>> cart = session[”hash”][:cart]
Reloading the console:
>> reload!
Rollback all database changes on exit:
$ script/console --sandbox
Loading development environment in sandbox.
Any modifications you make will be rolled back on exit.
>>
To maintain history across console sessions, add the following to ~/.irbrc:
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
See also:
$ cheat rails_console