ActionView::MissingTemplate when trying out Devise Login Items
-
27-09-2019 - |
Question
Now, I have to admit, I'm totally new to Ruby on Rails and don't quite understand every concept. I have installed Devise for authentication and followed this guide to include sign up and log in links in my views.
Here's what I did in my application.html.erb
:
<ul class="hmenu">
<%= render 'devise/menu/registration_items' %>
<%= render 'devise/menu/login_items' %>
</ul>
And my views/devise/menu/_login_item.html.erb
looks like this:
<% if user_signed_in? %>
<li>
<%= link_to('Logout', destroy_user_session_path) %>
</li>
<% else %>
<li>
<%= link_to('Login', new_user_session_path) %>
</li>
<% end %>
Now I get the following error message:
ActionView::MissingTemplate in Home#index
Missing partial devise/menu/login_items with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/Users/blah/Documents/webapp/mapeval/app/views", "/Users/blah/.rvm/gems/ruby-1.9.2-p0/gems/devise-1.1.3/app/views"
What is the cause of that error?
Solution
Your partial has invalid filename (missing s at the end). Rename views/devise/menu/_login_item.html.erb
to views/devise/menu/_login_items.html.erb
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow