Module: SaferRailsConsole::Patches::Sandbox::Rails::Console

Defined in:
lib/safer_rails_console/patches/railtie/sandbox.rb

Instance Method Summary collapse

Instance Method Details

#start(*args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/safer_rails_console/patches/railtie/sandbox.rb', line 8

def start(*args)
  options = args.last

  if options[:sandbox].nil?
    options[:sandbox] = if options[:'read-only']
                          true
                        elsif options[:writable]
                          false
                        elsif SaferRailsConsole.sandbox_environment? &&
                            SaferRailsConsole.config.sandbox_prompt
                          SaferRailsConsole::Console.sandbox_user_prompt
                        else
                          SaferRailsConsole.sandbox_environment?
                        end
  end

  super *args
end