私は Omniauth でこのチュートリアルに従っていました: http://railscasts.com/episodes/235-omniauth-part-1?view=asciicast
このエラーが発生し続けます:
そのような列はありません: authentication.provider:
ここで知りたい主なことは、「プロバイダー」が受け入れられない理由です。それはクラスに存在します...認証データベースが存在します...では、なぜそこにないと言っているのですか?
これが私の認証コントローラーです:
class AuthenticationsController < InheritedResources::Base
def index
@authentications = current_user.authentications if current_user
end
def create
@user = User.where(authentication: auth).first_or_create(:provider => auth['provider'], :uid => auth['uid'])
self.current_user = @user
# auth = request.env["omniauth.auth"] current_user.authentications.create(:provider => auth['provider'], :uid => auth['uid'])
flash[:notice] = "Authentication successful."
redirect_to authentications_url
end
def auth
request.env['omniauth.auth']
end
def destroy
@authentication = current_user.authentications.find(params[:id])
@authentication.destroy
flash[:notice] = "Successfully destroyed authentication."
redirect_to authentications_url
end
end
認証と呼ばれるモデルがあり、このモデルにはプロバイダーと uid フィールドがあることを保証できます。where(authentications: auth) と where(auth: auth) も試しましたが、それぞれうまくいきませんでした。
どんなアイデアでも大歓迎です。
アップデート
authentication.rb (モデル)
class Authentication < ActiveRecord::Base
attr_accessible :create, :destroy, :index, :provider, :uid, :user_id
belongs_to :user
end
更新 2
私は基本的に、このチュートリアルを Rails 3.2 に適応させようとしています。
チュートリアルの元の行は上でコメントアウトされています。
UPDATE 3 エラーの最初の行全体は次のとおりです。
SQLite3::SQLException: そのような列はありません: authentication.provider: SELECT "users".* FROM "users" WHERE "authentication"."provider" = 'facebook' AND "authentication"."uid" = '2222222' AND "authentication "."info" = '--- !ruby/hash:OmniAuth::AuthHash::InfoHash
重荷になるのは嫌だ...でも時計は刻一刻と刻々と過ぎていて、私のお尻は危機に瀕しており、私はこれを理解しようとして完全に狂ってしまいそうです. プロバイダーが受け入れられない理由を教えていただければ、残りの部分を理解できると確信しています。