私はOmniAuth railscastsに従っており、railscastに示されているように、devise + twitterの代わりにauthlogic + facebookで同じことを実装しようとしています。
私の理解はhas_many
まだ良くないかもしれませんが、Railscasts ryan には次のコードがありますAuthenticationsController
def create
auth = request.env["rack.auth"]
current_user.authentications.find_or_create_by_provider_and_uid(auth['provider'], auth['uid'])
flash[:notice] = "Authentication successful."
redirect_to authentications_url
end
私の実装current_user.authentications
では、配列を返すには[]
どうすれば配列を呼び出すことができfind_or_create_by_provider_and_uid
ますか?
私の実装は間違っていますか?has_many
配列を返すとは思わないのですか?
私が得るエラーは、オブジェクトを呼び出しfind_or_create_by_provider_and_uid
ているということです。nil
current_user.authentications
ユーザーはまだ認証を受けていないため、nil です。