我正在使用设计& commontator gems
我不知道关于" current_user"的错误。当试图"显示"产品!!
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
答案 0 :(得分:0)
基于型号名称的设计助手
所以current_registered_user
不是current_user
必须在commontator初始化程序文件中更改它,然后重新启动服务器