Reputation: 308
If I delete a post, it takes me to post/index.html.erb
, but I want it to redirect to the profile/index.html.erb
page.
<% current_user.posts.each do |post| %>
<%= post.post_name %> </p>
<%= link_to "view", post, class: "btn btn-default" %>
<%= link_to "Delete", post_path(post), method: :delete,
data: { confirm: "Are you sure?" },
class: "btn btn-default" %>
<% end %>
Upvotes: 0
Views: 53
Reputation: 230306
You're looking at the wrong code. Your view has nothing to do with this. Fix/change the redirection in your PostsController#destroy
.
Upvotes: 4