NullObject should respond to #to_a and return empty Array

because you code may containt code like this:
ActiveRecord::Base.connection.execute(query).to_a.flatten.first