If you see this error:
NoMethodError: undefined method `result' for #<TypeError: wrong argument type nil (expected Array)>
It's very likely you have the same issue I encoutered.
Basically, inside ActiveRecord there's a little method called configure_connection
which does exactly that. It checks an instance variable called @config
for @config[:encoding]
and if that's present, it calls:
if @config[:encoding]
@connection.set_client_encoding(@config[:encoding])
end
That in turns calls PGconn.set_client_encoding which causes an immediate Segmentation Fault (segfault). That's Ruby's way of saying fuck that and tipping over.
I'm not sure what the root cause of this issue is, but since I noted that I was using a rather old version of the PG gem (0.11.0 from 2011) with a rather new version of Ruby, I checked the PG gem's changelog. Sure enough, only version 0.15.0 of the PG gem seems to have been tested with Ruby 2.0.0.
After running bundle update pg
my application started properly and the issue appeared to be resolved.