Refactored edit function to work properly using form_for like in new.html.erb