rails:如何覆盖cocoon gem helper方法并调用原始方法

时间:2014-08-13 01:52:25

标签: ruby-on-rails gem cocoon-gem

我需要覆盖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

1 个答案:

答案 0 :(得分:0)

# in a helper or initializer
def link_to_add_association(*args, &block)
  #...do something
  super
end