Fix boolean tests and matching for minor issue in rails