我想用这样的东西控制许可方法
类SomethingController < ApplicationController 许可:somerole end
其中 ':somerole' 是数据库中链接到控制器和操作的字段。具有特权的用户可以管理和更改的东西。
一些想法?
我想用这样的东西控制许可方法
类SomethingController < ApplicationController 许可:somerole end
其中 ':somerole' 是数据库中链接到控制器和操作的字段。具有特权的用户可以管理和更改的东西。
一些想法?
这只是例如我有
class Admin::AdminController < ApplicationController
before_filter :login_required
before_filter :only_moderator_and_above
layout 'admin'
def only_moderator_and_above
unless current_user.has_admin_access?
flash[:notice] = CustomMessages.admin_permission_alert
redirect_to '/'
end
end
end