Methods
N
S
Class Public methods
new(app)
    # File railties/lib/rails/commands/console.rb, line 11
11:     def initialize(app)
12:       @app = app
13:     end
start(app)
   # File railties/lib/rails/commands/console.rb, line 7
7:     def self.start(app)
8:       new(app).start
9:     end
Instance Public methods
start()
    # File railties/lib/rails/commands/console.rb, line 15
15:     def start
16:       options = {}
17: 
18:       OptionParser.new do |opt|
19:         opt.banner = "Usage: console [environment] [options]"
20:         opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v }
21:         opt.on("--debugger", 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v }
22:         opt.on('--irb', "DEPRECATED: Invoke `/your/choice/of/ruby script/rails console` instead") { |v| abort '--irb option is no longer supported. Invoke `/your/choice/of/ruby script/rails console` instead' }
23:         opt.parse!(ARGV)
24:       end
25: 
26:       @app.sandbox = options[:sandbox]
27:       @app.load_console
28: 
29:       if options[:debugger]
30:         begin
31:           require 'ruby-debug'
32:           puts "=> Debugger enabled"
33:         rescue Exception
34:           puts "You need to install ruby-debug to run the console in debugging mode. With gems, use 'gem install ruby-debug'"
35:           exit
36:         end
37:       end
38: 
39:       if options[:sandbox]
40:         puts "Loading #{Rails.env} environment in sandbox (Rails #{Rails.version})"
41:         puts "Any modifications you make will be rolled back on exit"
42:       else
43:         puts "Loading #{Rails.env} environment (Rails #{Rails.version})"
44:       end
45: 
46:       IRB::ExtendCommandBundle.send :include, Rails::ConsoleMethods
47:       IRB.start
48:     end