Getting undefined method `username' for #<UserSession: no credentials provided> with Authlogic after push to production

独自空忆成欢 提交于 2019-12-13 04:09:09

问题


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.

Details below:

 NoMethodError in User_sessions#new

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 />

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.

Anyone have any ideas?


回答1:


Have you tried to run on the same database in production as in development?




回答2:


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 (undefined method 'username' for #<UserSession: no credentials provided>)

, 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!



来源:https://stackoverflow.com/questions/2255176/getting-undefined-method-username-for-usersession-no-credentials-provided

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!