cod*_*hal 9 elixir phoenix-framework
如何使用插头对凤凰的具体操作.想要使用插件进行某些操作的场景,或者相反,不希望在某些操作中使用插件
cod*_*hal 26
正如"渲染"文档底部的文档中所指定的那样,我们可以使用guard子句
plug/2支持防护,允许开发人员将插件配置为仅在某些特定操作中运行
plug :log_message, "before show and edit" when action in [:show, :edit]
plug :log_message, "before all but index" when not action in [:index]
# or
plug :log_message, "before all but index" when action not in [:index]
Run Code Online (Sandbox Code Playgroud)
第一个插件仅在显示或编辑操作时运行.除索引操作外,第二个插件将始终运行.
经过一番搜索,我发现了这个问题.这引导我进入文档.希望它可以帮助某人
| 归档时间: |
|
| 查看次数: |
3566 次 |
| 最近记录: |