views:

718

answers:

2

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 #

Extracted source (around line #6):

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

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  A: 

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

klew
Yes, that made it work. Thanks very much. Do you have any idea why that might have corrected it?
Dion Hinchcliffe
Probably you didn't run migrations in production environment. Try `rake db:migrate RAILS_ENV=production` with old database.
klew
A: 

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!

Ole Morten Amundsen