Moamen Abdelwahed
Moamen Abdelwahed

Reputation: 617

undefined method `current_user' ( commontator + devise )

I am using devise & commontator gems

i don't know what the error about "current_user" when try to "show" the product !!

undefined method `current_user' for #<ProductsController:0xd09600c>

user model

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

product model

class Product < ActiveRecord::Base
    # Product can be commented on
    acts_as_commontable
end

i call show method from ProductsController

class ProductsController < ApplicationController
  def show
    commontator_thread_show(@product)
  end
end

Upvotes: 0

Views: 1013

Answers (1)

Moamen Abdelwahed
Moamen Abdelwahed

Reputation: 617

the devise helper based on model name

so it is current_registered_user not current_user

have to change it in commontator initializer file then restart the server

Upvotes: 0

Related Questions