Devise:NoMethod Error& user_signed_in [英] Devise: NoMethod Error & user_signed_in

查看:129
本文介绍了Devise:NoMethod Error& user_signed_in的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用user_signed_in?添加一个登录区域到我的rails 3应用程序使用devise 1.1.3和我得到一个NoMethodErrorin规则#索引

 <%如果user_signed_in? - %GT; 
< div id =user_login_boxstyle =float:right>
<%= current_user.email%> |
<%= link_to'我的信息',edit_user_registration_path%> |
<%= link_to'注销',destroy_user_session_path%>
< / div>
<%end - %>

我不知道究竟是什么错,但显然设计方法没有被使用。我也公平(读:真的)新的rails,并没有使用devise。

解决方案

你似乎是在用户模型中缺少调用 devise:database_authenticatable



另外,开始使用devise的好方法是查看Ryan Bates的优秀 RailsCast :介绍设计


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.

解决方案

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.

这篇关于Devise:NoMethod Error&amp; user_signed_in的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆