开发者

Devise: NoMethod Error & user_signed_in

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: r开发者_如何学Goeally) new to rails and haven't used devise before.


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


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!


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜