refactor post controller to include before block with edit, update partial method