1

我需要覆盖茧宝石中的方法,然后调用原始方法。如何才能做到这一点?

# 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
4

1 回答 1

0
# in a helper or initializer
def link_to_add_association(*args, &block)
  #...do something
  super
end
于 2014-08-13T08:02:20.387 回答