require_same_user approach didn't work. removed edit post link from post index page and added condition to show edit link on show post page only if current user is post creator.