Ruby on rails 未定义的方法“当前用户”(CommonStator+Deviate)
我正在使用Desive&commontator宝石 我不知道当前用户在尝试展示产品时出现了什么错误Ruby on rails 未定义的方法“当前用户”(CommonStator+Deviate),ruby-on-rails,ruby-on-rails-4,devise,Ruby On Rails,Ruby On Rails 4,Devise,我正在使用Desive&commontator宝石 我不知道当前用户在尝试展示产品时出现了什么错误 undefined method `current_user' for #<ProductsController:0xd09600c> 用户模型 class RegisteredUser < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable,
undefined method `current_user' for #<ProductsController:0xd09600c>
用户模型
class RegisteredUser < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Registered user can comment on a product
acts_as_commontator
end
产品模型
class Product < ActiveRecord::Base
# Product can be commented on
acts_as_commontable
end
我从ProductsController调用show方法
class ProductsController < ApplicationController
def show
commontator_thread_show(@product)
end
end
基于模型名的设计助手 所以它是当前注册用户而不是当前用户
必须在CommonStator初始值设定项文件中更改它,然后重新启动服务器从消息中可以看出,错误来自产品控制器。显示该类中的代码会很有帮助