views:

45

answers:

1

I have successfully integrated facebook connect in my rails app with authlogic.

The problem is that if try to update the profile details of the facebook user there is a validation error that the password field cannot be blank.

To solve the above issue, I added following to the User model.

  before_validation :update_authlogic_config

  def update_authlogic_config
    validate_password_field = !facebook_user?
    validate_email_field = !facebook_user?
  end

  def facebook_user?
    !facebook_uid.blank?
  end

After adding this code, there are not validation errors, but still the validation fails.

user.valid? retruns false
user.errors.size return 0

if in the controller I do

@user.update_attributes!(params[:user])

the the exception which is raise is

Validation failed:

without any specific error.

Regards, Pankaj

A: 

I found a hack.

Populated the the password field for the facebook user with some value. Anyways this values would not be used, so it works.

def before_connect(fb_user) self.crypted_password = "test" self.password_salt = "test_salt" end