Adding an edit function, moved index method to posts controller