Refactor methods in posts_controller and make form partials