how to pass an argument to rails console..?

Hi,

I could not find how to pass the --sandbox option to the rails console, even though the option is defined in console.rb. Can you let me know?

thanks,
Murat

2 comments
Comment actions Permalink

I've tried using the Tools > Run Rails Script .. option instead but am getting an unintended ROLLBACK:

/Users/../.rvm/rubies/ruby-1.9.2-p290/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/muratcetin/RubymineProjects/new_app/script/rails console --sandbox development
Loading development environment in sandbox (Rails 3.2.2)
Any modifications you make will be rolled back on exit
Switch to inspect mode.
   (0.3ms)  ROLLBACK
/Users/../.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/magic-file.rb:7:in `initialize': No such file or directory - development (Errno::ENOENT)
 from /Users/../.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/magic-file.rb:7:in `open'
 from /Users/../.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/magic-file.rb:7:in `open'
 from /Users/../.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/input-method.rb:77:in `initialize'
 from /Users/../.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/context.rb:82:in `new'
 from /Users/../.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/context.rb:82:in `initialize'
 from /Users/../.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb.rb:99:in `new'
 from /Users/../.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb.rb:99:in `initialize'
 from /Users/../.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb.rb:56:in `new'
 from /Users/../.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb.rb:56:in `start'
 from /Users/../.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in `start'
 from /Users/../.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in `start'
 from /Users/../.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.2/lib/rails/commands.rb:41:in `<top (required)>'
 from /Users/../RubymineProjects/new_app/script/rails:6:in `require'
 from /Users/../RubymineProjects/new_app/script/rails:6:in `<top (required)>'
 from -e:1:in `load'
 from -e:1:in `<main>'


Any ideas how I can avoid the switch to inspect mode?

thanks,
Murat
0
Comment actions Permalink

(RubyMine 5.0)

1. Tools > Run Rails Console...
2. A temporary Run configuration will automatically be created; go to Run > Edit Configurations and select it in the left panel
3. [Here's where you pass the argument] Configuration tab > IRB arguments = console --sandbox
4. [Optional] I added " (Sandbox)" to the default generated configuration name, and saved the configuration (made it permanent)
5. OK to close the Edit Configuration window
6. Run panel, click the "Rerun" button to restart the console with the sandbox option

Sorry, I can't speak to your second post regarding unexpected rollbacks when using the run script functionality

0

Please sign in to leave a comment.