2012-12-28 13 views
8

がどのように私はこのように書いたの懸念を持つことができます。my_concern_magicをオーバーロードモデルに含まれているactivesupportの方法をオーバーロード::懸念

module Concerns 
    module MyConcern 
    extend ActiveSupport::Concern 
    ... 
    def my_concern_magic(arg0,arg1) 
     #exciting stuff here 
    end 
    end 
end 

?例えば。モジュールを含むので、

class User 
    include Concerns::MyConcern 
    ... 
    def my_concern_magic(arg0) 
    arg1 = [1,2,3] 
    my_concern_magic(arg0,arg1) 
    end 
end 

答えて

11

先祖チェーンに挿入し、あなただけのsuperを呼び出すことができます。

class User 
    include Concerns::MyConcern 

    def my_concern_magic(arg0) 
    arg1 = [1, 2, 3] 
    super(arg0, arg1) 
    end 
end 
+0

おかげアンドリュー!魅力のように働いた。 –

関連する問題