authentication - ActiveAdmin Ratyrate unable to find current_user OR Alternative -


i have been trying integrate raytrate activeadmin when trying include partial activeadmin supply_company.rb apears unable find 'current_user'. know standard install of activeadmin , devise have left admin user admin_user should able use current_admin_user set current user. have suspicion way in i'm trying include render in sidebar.

or if has alternative model rating know works in activeadmin gladly take @ it.

the error message is actionview::template::error (undefined local variable or method `current_user' #<#:0x6b50a58>):

app/controllers_rater_controller.rb

class ratercontroller < applicationcontroller    def create     if admin_user_signed_in?       obj = params[:klass].classify.constantize.find(params[:id])       obj.rate params[:score].to_f, current_admin_user, params[:dimension]        render :json => true     else       render :json => false     end   end end 

app/models/admin_user.rb

class adminuser < activerecord::base   rolify   has_one :profile, foreign_key: :admin_user_id   accepts_nested_attributes_for :profile    has_many :addresses   has_many :address_types, :through => :addresses    accepts_nested_attributes_for :addresses    ratyrate_rater    # include default devise modules. others available are:   # :confirmable, :lockable, :timeoutable , :omniauthable   devise :database_authenticatable,           :recoverable, :rememberable, :trackable, :validatable    has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb =>    "100x100>" }, :default_url => "/images/:style/missing.png"   validates_attachment_content_type :avatar, :content_type => /\aimage\/.*\z/  end 

app/models/supply_companies.rb

class supplycompany < activerecord::base    has_many :products, :through => :product_supply_companies   has_many :product_supply_companies, :foreign_key => 'supply_company_id'    accepts_nested_attributes_for :products   accepts_nested_attributes_for :product_supply_companies, :allow_destroy => true    ratyrate_rateable "communication", "quality", "price" end 

/app/admin/supply_company.rb

activeadmin.register supplycompany    permit_params :id, :company_name,                  products_attributes: [:id, :product_name, :product_description],                  product_supply_companies_attributes: [:id, :product_id],                  supply_company_ratings_attributes: [:id, :admin_user_id, :supply_company_id, :supply_company_rating ],                  admin_user_attributes: [:id]   index     column :id     column :company_name     column :products |pt|       pt.products.collect {|c| c.product_name.capitalize }.to_sentence     end     actions   end  filter :company_name     form(:html => {:multipart => true}) |f|      f.inputs "company details"      f.input :company_name      end      f.actions    end    show title: :company_name      attributes_table        row :company_name      end      end    sidebar "products", only: :show     attributes_table_for supply_company       row "ratings"         render  'supply_company_ratings'       end       row :products |pt|         pt.products.collect {|c| link_to c.product_name.capitalize, admin_products_path + "\/" + c.id.to_s}.join(", ").html_safe       end     end   end end 

app/views/admin/supply_companies/_supply_companines_ratings.html.erb

<h2>communication  :</h2> <%= rating_for @supply_company, "communication" %> <h2>engine :</h2> <%= rating_for @supply_company, "quality" %> <h2>price  :</h2> <%= rating_for @supply_company, "price" %> 

sound's have installed ratyrate rails g ratyrate user, need install rails g ratyrate admin_user.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -