Reputation: 359
I'm trying to use user_signed_in? to add a login area to my rails 3 application using devise 1.1.3 and I get a NoMethodErrorin Rules#index
<% if user_signed_in? -%>
<div id="user_login_box" style="float:right">
<%= current_user.email %> |
<%= link_to 'My info', edit_user_registration_path %> |
<%= link_to 'Sign out', destroy_user_session_path %>
</div>
<% end -%>
I'm not sure what's wrong exactly, but clearly the devise method isn't being used. I'm also fairly (read: really) new to rails and haven't used devise before.
Upvotes: 1
Views: 6061
Reputation: 469
It also may happen that your trying to call that route from another engine, so in that case you have to specify the context for that route, like main_app.edit_user_registration_path
.
Upvotes: 1
Reputation: 8105
I had the exactly the same issue.
undefined local variable or method 'edit_user_registration_path'
However, I have devise :database_authenticatable
, but not :registerable
. After I added the :registerable
everything works!
Upvotes: 3
Reputation: 18250
What is the name of the model you generated Devise for?
If you called it something else instead of User, you might want to check out http://groups.google.com/group/plataformatec-devise/msg/67f1eb5a571b6136
Upvotes: 5
Reputation: 65457
You seem to be missing the call to devise :database_authenticatable
in your User
model.
Also, a good way to get started with devise is to look at the excellent RailsCasts by Ryan Bates : Introducing Devise.
Upvotes: 1