Skip to content

Instantly share code, notes, and snippets.

@carld
Last active August 29, 2015 14:26
Show Gist options
  • Save carld/dc4e772d745b6c8f112e to your computer and use it in GitHub Desktop.
Save carld/dc4e772d745b6c8f112e to your computer and use it in GitHub Desktop.
How to get a Rails console when script/rails won't work - particularly when you don't have readline
$ bundle exec script/console
Loading production environment (Rails 2.3.18)
/opt/rubyenterprise/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
from /opt/rubyenterprise/lib/ruby/1.8/irb/completion.rb:10
from /opt/rubyenterprise/lib/ruby/1.8/irb/init.rb:254:in `require'
from /opt/rubyenterprise/lib/ruby/1.8/irb/init.rb:254:in `load_modules'
from /opt/rubyenterprise/lib/ruby/1.8/irb/init.rb:252:in `each'
from /opt/rubyenterprise/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
from /opt/rubyenterprise/lib/ruby/1.8/irb/init.rb:21:in `setup'
from /opt/rubyenterprise/lib/ruby/1.8/irb.rb:54:in `start'
from /opt/rubyenterprise/bin/irb:13
$ bundle exec irb
irb(main):001:0> require File.expand_path('config/boot')
=> true
irb(main):002:0> require File.expand_path('config/environment')
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /export/home/deploy/recon/shared/bundle/ruby/1.8/gems/rails-2.3.18/lib/rails/gem_dependency.rb:21.
Warning: NLS_LANG is not set. fallback to US7ASCII.
=> true
irb(main):003:0> Article.last
=> #<Article id: 13584, ...>
irb(main):004:0>
irb(main):027:0> require 'console_app'
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment