使用Restforce gem的Rails应用程序:未定义的局部变量或方法`current_user'

时间:2017-06-08 03:02:50

标签: ruby-on-rails ruby-on-rails-4 salesforce restforce

我按照https://github.com/GoogleCloudPlatform/cloudml-samples/blob/master/flowers/trainer/model.py#L393的说明进行了操作 当我运行rake db:migrate时,我收到以下错误:

  

NameError: undefined local variable or method 'current_user' for   TomtomCusu::Application:Class

该方法在 application_controller.rg

中定义
class ApplicationController < ActionController::Base
 # Prevent CSRF attacks by raising an exception.
 # For APIs, you may want to use :null_session instead.
 protect_from_forgery with: :exception

 private

  def current_user
   @current_user ||= User.find(session[:user_id]) if session[:user_id]
  end

  helper_method :current_user

end

0 个答案:

没有答案