我需要覆盖cocoon gem中的方法,然后调用原始方法。怎么办呢?
# gem code
module Cocoon
module ViewHelpers
def link_to_add_association(*args, &block)
#...stuff
end
end
end
# in a helper or initializer
def link_to_add_association(*args, &block)
#...do something
<call original method>
end
答案 0 :(得分:0)
# in a helper or initializer
def link_to_add_association(*args, &block)
#...do something
super
end