Namespace

Module

Methods

Attributes

[R] app
[R] console
[R] options

Class Public methods

new(app, options = {})

📝 Source code
# File railties/lib/rails/commands/console/console_command.rb, line 24
    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
🔎 See on GitHub

start(*args)

📝 Source code
# File railties/lib/rails/commands/console/console_command.rb, line 18
    def self.start(*args)
      new(*args).start
    end
🔎 See on GitHub

Instance Public methods

environment()

Also aliased as: environment?
📝 Source code
# File railties/lib/rails/commands/console/console_command.rb, line 42
    def environment
      options[:environment]
    end
🔎 See on GitHub

environment?()

Alias for: environment

sandbox?()

📝 Source code
# File railties/lib/rails/commands/console/console_command.rb, line 38
    def sandbox?
      options[:sandbox]
    end
🔎 See on GitHub

set_environment!()

📝 Source code
# File railties/lib/rails/commands/console/console_command.rb, line 47
    def set_environment!
      Rails.env = environment
    end
🔎 See on GitHub

start()

📝 Source code
# File railties/lib/rails/commands/console/console_command.rb, line 51
    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
🔎 See on GitHub