私はチュートリアルに従っています: http://railscasts.com/episodes/235-omniauth-part-1?autoplay=true
独自のサインインとサインアウトのプロセスが機能しています。しかし、Twitterのログインを認証しようとすると、
AuthenticationsController#create の NoMethodError
undefined method `authentications' for nil:NilClass
app/controllers/authentications_controller.rb:8:in `create'
私のルートは次のとおりです。
match '/auth/:provider/callback', to: 'authentications#create'
私の認証コントローラーでは、 create メソッドは次のとおりです。
def create
auth = request.env["omniauth.auth"]
current_user.authentications.create(:provider => auth[:provider], :uid => auth[:uid])
flash[:notice] = "Success"
redirect_to authentications_url
end
何が問題なのかわからない:/
あなたが私を助けることができれば、それは素晴らしいことです.
ありがとう。