Gem Grape 如何以元编程的方式给 route 增加 callback?

tangmonk · January 02, 2016 · Last by tangmonk replied at January 06, 2016 · 2235 hits

Just like following:

add after callback to UserApi route with namespace and route "user_api/sign_in"

add_callback :after, "user_api/sign_in" do |params|
   do_something
end

我看了下 grape 的代码,表示有点看不懂。。

你要的需求 Grape 已经有方案了啊 你看看https://github.com/ruby-grape/grape#before-and-after

#1 楼 @edisonhsu 恩,这个我知道,我想用元编程的方式来动态的增加 callback

You need to Sign in before reply, if you don't have an account, please Sign up first.