use before_action in posts_controller