设计:NoMethod 错误 &用户登录 [英] Devise: NoMethod Error & user_signed_in
问题描述
我正在尝试使用 user_signed_in?使用设计 1.1.3 将登录区域添加到我的 rails 3 应用程序,我得到一个 NoMethodErrorin Rules#index
<% if user_signed_in?-%><div id="user_login_box" style="float:right"><%= current_user.email %>|<%= link_to '我的信息', edit_user_registration_path %>|<%= link_to '退出',destroy_user_session_path %>
<%结束-%>
我不确定到底出了什么问题,但显然没有使用设计方法.我对 Rails 也相当(阅读:真的)新手,之前没有使用过设计.
您似乎在 User
模型中缺少对 devise :database_authenticable
的调用.
此外,开始设计的一个好方法是查看 优秀 Ryan Bates 的 RailsCasts:介绍设计.
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.
这篇关于设计:NoMethod 错误 &用户登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!