2012-12-28 1 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

감사 앤드류를! 매력처럼 일했습니다. –