Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails ActiveRecord::语句在SessionController#create/SQLite3::SQLException中无效:没有这样的列:users.provider_Ruby On Rails_Ruby_Facebook_Activerecord_Sqlite - Fatal编程技术网

Ruby on rails ActiveRecord::语句在SessionController#create/SQLite3::SQLException中无效:没有这样的列:users.provider

Ruby on rails ActiveRecord::语句在SessionController#create/SQLite3::SQLException中无效:没有这样的列:users.provider,ruby-on-rails,ruby,facebook,activerecord,sqlite,Ruby On Rails,Ruby,Facebook,Activerecord,Sqlite,我试图在我的ap上创建facebook登录,当单击“使用facebook登录”时,我在运行时遇到此错误 ActiveRecord::StatementInvalid in SessionsController#create SQLite3::SQLException: no such column: users.provider: SELECT "users".* FROM "users" WHERE "users"."provider" = 'facebook' AND "users"."ui

我试图在我的ap上创建facebook登录,当单击“使用facebook登录”时,我在运行时遇到此错误

ActiveRecord::StatementInvalid in SessionsController#create
SQLite3::SQLException: no such column: users.provider: SELECT "users".* FROM "users" WHERE "users"."provider" = 'facebook' AND "users"."uid" = 'FACEBOOK KEY' ORDER BY "users"."id" ASC LIMIT 1

    Extracted source (around line #6):
    4      def self.from_omniauth(auth)
    5      where(auth.slice(:provider, :uid)).first_or_initialize.tap do |user|
    6      user.provider = auth.provider
    7      user.uid = auth.uid
    8      user.name = auth.info.name

Rails.root:/selfstarter

Application Trace | Framework Trace | Full Trace
app/models/user.rb:6:in `from_omniauth'
app/controllers/sessions_controller.rb:3:in `create'
下面是user.rb中的代码

class User < ActiveRecord::Base
  has_many :orders


  def self.from_omniauth(auth)
    where(auth.slice(:provider, :uid)).first_or_initialize.tap do |user|
      user.provider = auth.provider
      user.uid = auth.uid
      user.name = auth.info.name
      user.oauth_token = auth.credentials.token
      user.oauth_expires_at = Time.at(auth.credentials.expires_at)
      user.save!
    end
  end


end
class用户
下面是来自会话控制器的代码

class SessionsController < ApplicationController
    def create
    user = User.from_omniauth(env["omniauth.auth"])
    session[:user_id] = user.id
    redirect_to root_path
  end

  def destroy
    session[:user_id] = nil
    redirect_to root_path
  end
end
class sessioncontroller
用户
表中是否有
提供程序
列?您是否错过了将
提供程序
列添加到
用户
表中的迁移?在用户表中有一个提供程序列,我也运行了迁移,但仍然收到相同的错误