bragboy
bragboy

Reputation: 35542

Help me with this ActiveRecord Error in rails

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.

Upvotes: 0

Views: 34

Answers (1)

alex.zherdev
alex.zherdev

Reputation: 24174

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

Upvotes: 2

Related Questions