I was going through RailsCast 209-devise-revised. In that in application.html.erb
this code is given(changed the paths)
<div id="container">
<div id="user_nav">
<% if user_signed_in? %>
Logged in as <strong><%=current_user.email %></strong>
<%= link_to 'Edit_profile',edit_blog_post_path%>
<%= link_to 'LogOut', destroy_user_session_path%>
<%else %>
<%= link_to 'Sign Up', new_user_path %>
<%= link_to 'Login', new_user_session_path %>
<% end%>
</div>
</div>
problem is that in RailsCast this file works fine, but for me
No route matches {:action=>"edit", :controller=>"blog_posts"} missing required keys: [:id]
error is thrown.
1) How did it work in railscast without giving the id
?
2) In application.html.erb
how to I give the id?
While you already accepted the answer, imho the correct answer should be:
<%= link_to 'Edit_profile', edit_user_path(current_user) %>
Because I would presume you want to edit the user, not a blog-post whose id is accidentally identical to the id of the user.