replaced model.find with model.where in order to prevent errors from being thrown.