Closed szimek closed 14 years ago
That line tries to auto-detect scope. Uhm...without the form you won't get a Devise session, logging in on Facebook is just not enough. What version of Devise you use? Devise moved forward quite fast so the API might have changed, will have a look later on. Use Devise <= 1.0.0, I won't support newer one yet myself as it's built for Rails 3 only and Rails is....beta.
I'm not saying that this line should be removed completely :) I'm just saying that it should be changed from: scope = ::Devise::Mapping.find_by_path(request.path).to rescue scope which for url /users/sign_up returns User class, to: scope = ::Devise::Mapping.find_by_path(request.path).name rescue scope which returns :user symbol :)
I edited my original post to include a patch, but it got lost somehow... Here it is again: szimek/devise_facebook_connectable@1fa5b5c08b670caba6d22d14afa92bf42dff519e
OK, thanks!
Fixed old bug where incorrect scope gets auto-detected. Closed by 2d9b2d73c41bc1d75082f6642102dc26383cc30a
The problem is actually in facebook_connect_form helper. scope = ::Devise::Mapping.find_by_path(request.path).to rescue scope Devise::Mapping.find_by_path(arg).to return a class i.e. User. When form_for(scope) is called later, it actually calls form_for(User) and Rails tries to call dom_id method on User, which in turn calls #id method. In Ruby 1.8 it raises just a warning, but in 1.9 this method is missing.
I'm not sure why this form is needed inside facebook_sign_in_link at all, but switching from #to to #name method in the line mentioned above fixes the problem.