Archive for November, 2008

activesupport + json `to_json’: wrong argument type

encoding.rb:21:in `to_json’: wrong argument type Hash (expected Data) (TypeError)

Seems to occur with floating point numbers and when json is required before activesupport

For example:

require ‘rubygems’
require ‘json’
require ‘activesupport’

[{:val => 256.0}].to_json

One way to hack around this is to make the float a string.

Leave a Comment

Capistrano hanging with no output

Another issue you may come across…If you find Capistrano just hanging when you run it and producing no output, it could be because your server list contains one bad server. If this is the case Capistrano will appear to hang and produce no output.


Leave a Comment

Net::SSH / Capistrano asking for password

If you find Capistrano not connecting with your private key and asking for a password, it may be because you’re missing the public part of the key.

ssh-keygen -y -f ~/.ssh/mykey

This will print out the public key for a given private key in OpenSSH format. Name your key with a .pub ( in my case) and you’re good to go.

Similarly with Net::SSH you may get something like the following:

/usr/local/lib/ruby/gems/1.8/gems/net-ssh-2.0.4/lib/net/ssh.rb:195:in `start’: root (Net::SSH::AuthenticationFailed)

This can also be fixed by creating a public key file for your private key.


Leave a Comment