如何使用JSONAPI :: Resources覆盖PATCH请求

时间:2019-01-16 10:57:30

标签: ruby-on-rails ruby-on-rails-4 jsonapi-resources

如何拦截Suggest(new List<string> { "another", "another one" }, contextMenuStrip1); 动作并在resource.rb文件中而不是在控制器中覆盖它。

1 个答案:

答案 0 :(得分:0)

有一个before_update钩子,以resource callback的形式存在。根据文档,这是最新的stable guide

中的建议选项
Note: The authors of this gem expect the most common uses cases to be
handled using the callbacks. It is likely that the internal functionality 
of the operation processing methods will change, at least for several
revisions. Effort will be made to call this out in release notes. You 
have been warned.

如果您想覆盖整个操作,我相信您需要编写自己的自定义处理器。我认为进行更新,您需要查看replace fields。我将从update操作开始,然后沿着process_request进行跟踪。