0
我没有使用插件,而是将教程http://ruby.railstutorial.org/chapters用于我的管理。但我遇到的问题如下管理系统导轨
class UsersController < ApplicationController
before_filter :signed_in_user, only: [:index, :edit, :update, :destroy]
before_filter :correct_user, only: [:edit, :update]
before_filter :admin_user, only: :destroy
我还想如果你是admin_user然后能够编辑,并更新客户。但由于correct_user的被使用,它不工作
我有尝试以下
def correct_customer
@customer = Customer.find(params[:id])
redirect_to(root_path) unless current_customer?(@customer) || customer.admin?
end
但后来我有一个未定义的客户。如果管理员修改选定的客户,允许用户使用什么是我的最佳方法。如果我点击一个客户#编辑(不是我)
NameError in CustomersController#edit
undefined local variable or method `customer' for #<CustomersController:0xa51fd60>
Rails.root: /home/jean/rail/map
它做的作品,但是现在如果我改变自己的出现
错误普通用户,我也有资格拥有管理员。为什么? – Jseb 2012-08-13 17:15:09