是否有可能做這樣的事情:紅寶石 - 有沒有辦法來調用父類的方法重載的
class A
def a(var)
puts "do something with #{var}"
end
end
class B < A
def a(var)
var = var + "some modification"
#this is what I want to do:
super.a(var)
end
end
謝謝!
在您的例子爲B類不是A和對象的子類不具有梅索德a,你想做什麼? – hotfix 2013-04-05 22:14:30
好的錯字...修正:) – mfcabrera 2013-04-05 22:15:50
http://stackoverflow.com/questions/3689736/rails-3-alias-method-chain-still-used可能與 – rogerdpack 2013-04-05 22:16:18