added update post logic to posts_controller.rb