views:

20

answers:

1

Hi,

I was deploying my application in staging and it use to work properly. But in the recent deployment I am getting a crazy error like this,

NoMethodError (undefined method `find_or_initialize_by_user_name' for #<Class:0xb6dd8388>):
  app/models/user.rb:49:in `find_or_create_account'
  app/models/user.rb:24:in `authenticate'
  app/controllers/application_controller.rb:42:in `login'
  /usr/website/coachportal/current/public/dispatch.fcgi:24

For which the line in user.rb reads this.

.......
  def find_or_create_account(ldap_entry = nil)
    acc = Account.find_or_initialize_by_user_name(self.user_name)
    acc_attrs = {}
.........

Here Account is an ActiveRecord Model, but I am getting an error that relates to Class:0xb6dd8388 Someone please help me!!

Thanks.

+2  A: 

You should check your database schema: the reason of such an error could be the absence of user_name column in the accounts table.

neutrino
Someone have corrupted the account table in the system which messed up all the columns.. Thanks dude.. you saved my day!
Bragboy