【发布时间】:2011-07-24 03:56:33
【问题描述】:
我有一个方法如下:
26 User.create!(:email => "token@email.com", :linkedin_uid => linkedin_uid, :password => Devise.friendly_token[0,20])
这是我的控制器:
20 def create
21 @user = User.new(params[:user])
22 if @user.save
23 flash[:notice] = "Successfully created user."
24 redirect_to @user
25 else
26 render :action => 'new'
27 end
28 end
即使在我尝试通过传递参数 :linkedin_uid 来创建它时从 rails 控制台,它仍然是 nil。 :(
这是该行的上下文:
18 def self.find_for_linked_in_oauth(omniauth_hash, signed_in_resource=nil)
19 debugger
20 #omniauth_hash is a hash passed in from env["omniauth_hash"] by callback controller
21 linkedin_uid = omniauth_hash['uid']
22 debugger
23 if user = User.find_by_linkedin_uid(linkedin_uid)
24 user
25 else # Create an user with a stub password.
26 User.create!(:email => "token@email.com", :linkedin_uid => linkedin_uid, :password => Devise.friendly_token[0,20])
27 end
28 end
【问题讨论】:
标签: ruby-on-rails oauth devise