获取未定义的方法“用户名"#<UserSession:未提供凭据>推入生产后使用 Authlogic [英] Getting undefined method `username' for #<UserSession: no credentials provided> with Authlogic after push to production

查看:54
本文介绍了获取未定义的方法“用户名"#<UserSession:未提供凭据>推入生产后使用 Authlogic的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们从未让此应用在生产环境中运行.该应用程序在开发中运行得很好.我已经确保所有 rake 任务都是最新的,并且为用户设置了acts_as_authentic,以及每个人在所有论坛上发布的所有其他内容.服务器已被退回多次.每次在所有网址上都会出现此错误.

We've never gotten this app to run in production. The application runs just fine in dev. I've made sure all rake tasks are up to date and acts_as_authentic is set for the user and everything else that everyone has posted on all the forums. The server has been bounced multiple times. This error comes up every single time on all URLs.

详情如下:

 NoMethodError in User_sessions#new

显示 app/views/user_sessions/new.html.erb,其中第 6 行出现:

Showing app/views/user_sessions/new.html.erb where line #6 raised:

undefined method `username' for #<UserSession: no credentials provided>

Extracted source (around line #6):

3: <% form_for @user_session, :url => user_session_path do |f| %>
4:   <%= f.error_messages %>
5:   <%= f.label :username %><br />
6:   <%= f.text_field :username %><br />
7:   <br />
8:   <%= f.label :password %><br />
9:   <%= f.password_field :password %><br />

所以我快到绳子的尽头了.我读了很多对 Authlogic 的赞美,但我已经花了好几个小时试图让它一步一步地工作.我们必须启动此服务器,但我们所做的任何事情都无法消除此错误.我们目前正在认真考虑对开发环境进行虚拟化,以便用户完成工作.

So I'm getting towards the end of my rope. I read a lot of praise for Authlogic but I've spent hours and hours trying to get it to work one step at a time. We have to get this server up but nothing that we do can get this error to go away. We're seriously considering virtualizing the dev environment for now so the users can get something done.

有人有什么想法吗?

推荐答案

哈哈,我也觉得自己很蠢.服务器必须重新启动!我在 heroku 上设置了一个临时服务器,然后做了很棒的 heroku db:push.我也一直收到这个错误

hah, I felt equally stupid. The server has to be restarted! I set up a staging server at heroku, then did the awesome heroku db:push. I kept getting this error too

(ActionView::TemplateError(未定义方法 'username' for #<UserSession:未提供凭据>)

(ActionView::TemplateError (undefined method 'username' for #<UserSession: no credentials provided>)

,你在一个空的数据库(或未迁移)上得到它,但我在发出 heroku restart 后让它运行.无论如何,当我碰到这个线程时,我也不妨在这里发表我的观察.干杯!

, which you get on an empty db (or not-migrated), but I got it running after issuing heroku restart. Anyways, as I bumped into this thread, I might as well post my observation here too. Cheers!

这篇关于获取未定义的方法“用户名"#&lt;UserSession:未提供凭据&gt;推入生产后使用 Authlogic的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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