【文件属性】:
文件名称:punditry:Pundit 上的超薄包装纸
文件大小:5KB
文件格式:ZIP
更新时间:2021-06-17 19:08:29
Ruby
权威
顶部的超薄包装。
安装
将此行添加到应用程序的 Gemfile 中:
gem 'punditry'
然后执行:
$ bundle
在您的应用程序控制器中包含 Punditry:
class ApplicationController < ActionController :: Base
include Punditry :: Controller
end
用法
Punditry 本质上是 Pundit,有一些小的补充。 不是调用authorize ,而是调用authorize! . 这委托给下面的authorize ,但也会返回传入的资源,允许您删除一行代码:
# with Pundit
def update
@post = Post . find ( params [ :id ] )
authorize @post
if @post . update
【文件预览】:
punditry-master
----LICENSE.txt(1KB)
----lib()
--------punditry.rb(105B)
--------punditry()
----Gemfile(93B)
----Rakefile(29B)
----README.md(3KB)
----punditry.gemspec(868B)
----.gitignore(118B)