Namespace
Class
- Rails::Console::AppInstance
- Rails::Console::ControllerHelper
- Rails::Console::ControllerInstance
- Rails::Console::IRBConsole
- Rails::Console::NewSession
- Rails::Console::RailsHelperBase
- Rails::Console::ReloadCommand
- Rails::Console::ReloadHelper
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 13
def initialize(app, options = {})
@app = app
@options = options
app.sandbox = sandbox?
if sandbox? && app.config.disable_sandbox
puts "Error: Unable to start console in sandbox mode as sandbox mode is disabled (config.disable_sandbox is true)."
exit 1
end
app.load_console
@console = app.config.console || begin
require "rails/commands/console/irb_console"
IRBConsole.new(app)
end
end
🔎 See on GitHub
start(*args)
📝 Source code
# File railties/lib/rails/commands/console/console_command.rb, line 7
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 40
def environment
options[:environment]
end
🔎 See on GitHub
sandbox?()
📝 Source code
# File railties/lib/rails/commands/console/console_command.rb, line 32
def sandbox?
return options[:sandbox] if !options[:sandbox].nil?
return false if Rails.env.local?
app.config.sandbox_by_default
end
🔎 See on GitHub
set_environment!()
📝 Source code
# File railties/lib/rails/commands/console/console_command.rb, line 45
def set_environment!
Rails.env = environment
end
🔎 See on GitHub
start()
📝 Source code
# 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
console.start
end
🔎 See on GitHub