grimen / devise_facebook_connectable

Devise << Facebook Connect. IMPORTANT: Not maintained anymore.
MIT License
146 stars 20 forks source link

edit user profile question #21

Closed anrake closed 14 years ago

anrake commented 14 years ago

Not really an issue, but how can I edit User records when the user is a Facebook only user. The situation is that I have added several fields to my User model for "profile" data. I can edit the Devise forms to add these fields but Devise requires a password to authorize the user to Update the profile. For Facebook Users there is no password. I created a new controller and view for FB users but the system still rejects the Update, probably because there is no password authorization for Updates.

grimen commented 14 years ago

Could you show me your model code?

grimen commented 14 years ago

I mean...what you ask for should work too, so I need to see your devise-call in you affected user-model to see if something could be wrong with the load order of facebook_connectable vs email_authenticatable.

anrake commented 14 years ago

Hi, sorry for the slow reply. Does facebook_connectable need to be declared first?

model:

devise :authenticatable, :confirmable, :recoverable, :registerable, :rememberable, :trackable, :validatable, :facebook_connectable

attr_accessible :email, :password, :password_confirmation, :nickname

controller:

class FbusersController < ApplicationController

def edit @user = User.find(params[:id]) end

def update
@user = User.find(params[:id]) if @user.update_attributes(params[:user]) flash[:notice] = 'User was successfully updated.' redirect_to :controller => 'mypage', :action => "home", :id => current_user.visit_page else render :action => 'edit' flash[:notice] = 'User was NOT successfully updated.'
end end

end

Here is the output in terminal

Processing FbusersController#update (for 127.0.0.1 at 2010-05-07 22:19:36) [GET] Parameters: {"id"=>"37"} User Columns (1.6ms) SHOW FIELDS FROM users User Load (0.3ms) SELECT * FROM users WHERE (users.id = 37) SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK Rendering fbusers/edit Completed in 86ms (View: 50, DB: 2) | 200 OK [http://localhost/fbusers/update/37] SQL (0.1ms) SET SQL_AUTO_IS_NULL=0

grimen commented 14 years ago

You should try to put :facebook_connectable first.

anrake commented 14 years ago

That doesn't work either. Do you have a working model/sample code?

djfobbz commented 14 years ago

i'm having the same issue. cannot save extra user entered information by a fb_session user. it asks for a password & the following error is generated "Current password can't be blank". i did move the :facebook_connectable ahead of :authenticatable

i'm using the following gems:

rails (2.3.5) devise (1.0.7) facebooker (1.0.69) devise_facebook_connectable (0.2.1) warden (0.10.3) rails-footnotes (3.6.6)

grimen commented 14 years ago

Oh, sorry I must have been tired when I replied...you need to tell Devise authenticatable-migration to allow null:

t.database_authenticatable :null => true

That should work. Let me know how it goes.