edge badge
Namespace
Methods
E
N
S
Included Modules
Attributes
[R] app
[R] console
[R] options
Class Public methods
new(app, options = {})
# File railties/lib/rails/commands/console/console_command.rb, line 22
def initialize(app, options = {})
  @app     = app
  @options = options

  app.sandbox = sandbox?
  app.load_console

  @console = app.config.console || IRB

  if @console == IRB
    IRB::WorkSpace.prepend(BacktraceCleaner)
  end
end
start(*args)
# File railties/lib/rails/commands/console/console_command.rb, line 16
def self.start(*args)
  new(*args).start
end
Instance Public methods
environment()
Also aliased as: environment?
# File railties/lib/rails/commands/console/console_command.rb, line 40
def environment
  options[:environment]
end
environment?()
Alias for: environment
sandbox?()
# File railties/lib/rails/commands/console/console_command.rb, line 36
def sandbox?
  options[:sandbox]
end
set_environment!()
# File railties/lib/rails/commands/console/console_command.rb, line 45
def set_environment!
  Rails.env = environment
end
start()
# File railties/lib/rails/commands/console/console_command.rb, line 49
def start
  set_environment! if environment?

  if sandbox?
    puts "Loading #{Rails.env} environment in sandbox (Rails #{Rails.version})"
    puts "Any modifications you make will be rolled back on exit"
  else
    puts "Loading #{Rails.env} environment (Rails #{Rails.version})"
  end

  if defined?(console::ExtendCommandBundle)
    console::ExtendCommandBundle.include(Rails::ConsoleMethods)
  end
  console.start
end