added query fail to the ruby template