moved the post-related logic to posts_controller.rb