replace update function to model and add rake task