开发者

undefined method `find_by_provder_and_uid' for []:Array

开发者 https://www.devze.com 2023-03-03 19:10 出处:网络
I\'m following along with the开发者_运维问答 tutorial here: http://asciicasts.com/episodes/235-omniauth-part-1

I'm following along with the开发者_运维问答 tutorial here:

http://asciicasts.com/episodes/235-omniauth-part-1

In my controller I created the following method:

  def create  
    auth = request.env["omniauth.auth"]
    current_user.authentications.find_or_create_by_provder_and_uid(auth['provider'], auth['uid'])
    flash[:notice] = "Authentication successful."
    redirect_to authentications_url  
  end

Problem is it is erroring like so:

undefined method `find_by_provder_and_uid' for []:Array

Ideas why? thanks


It looks like that page has a typo -- it should be:

    current_user.authentications.find_or_create_by_provider_and_uid(auth['provider'], auth['uid'])

The original Railcast has it spelled properly. I just e-mailed the AsciiCasts author notifying him of the typo.

0

精彩评论

暂无评论...
验证码 换一张
取 消