What's New in Edge Rails: DB Console

Posted by ryan
at 4:39 PM on Tuesday, May 13, 2008

For those of you that haven’t committed the database username and passwords for your many apps to memory yet, there comes some help from edge Rails – the addition of a dbconsole script that will automatically drop you into a database prompt using the info in config/database.yml configuration.

In an edge rails app that has a mysql db config:

Update: Because of the insecure nature of passing in the password on the command line on shared hosts – you now need to use the -p or --include-password option to force the password to be read from your config file.

script/dbconsole -p
...
mysql>

And there I am, logged into the dev database in the mysql command prompt. No scrounging around for that app-specific username or db name or cat ing the config/database.yml file anymore.

tags: ruby, rubyonrails

"loaded_specs" Gem Error

Posted by ryan
at 3:30 PM on Tuesday, May 13, 2008

For those of you that have run into this gem error when running the latest rails:

./script/../config/../vendor/rails/railties/lib/initializer.rb:175:in `install_gem_spec_stubs': undefined method `loaded_specs' for Gem:Module (NoMethodError)
        from ./script/../config/../vendor/rails/railties/lib/initializer.rb:175:in `reject!'
        from ./script/../config/../vendor/rails/railties/lib/initializer.rb:175:in `install_gem_spec_stubs'
        from ./script/../config/../vendor/rails/railties/lib/initializer.rb:89:in `send'
        from ./script/../config/../vendor/rails/railties/lib/initializer.rb:89:in `run'
        from ./script/../config/boot.rb:46:in `load_initializer'
        from ./script/../config/boot.rb:38:in `run'
        from ./script/../config/boot.rb:11:in `boot!'
        from ./script/../config/boot.rb:109
        from script/dbconsole:2:in `require'
        from script/dbconsole:2

the solution is a quick and dirty:

gem update --system

Or, if you currently have rubygems v0.8.4 or earlier installed:

gem install rubygems-update
update_rubygems

Just a public service announcement from the “Ryan’s been bitten by this one” dept.