如何在关注中添加多个包含的块?

时间:2016-03-17 09:12:08

标签: ruby-on-rails ruby hook activesupport-concern

一切都说明如下:

# below is a common lib definition.
module SomeLib
    extend ActiveSupport::Concern

    included do
        puts 'executing predefined block from lib'
    end
end

# I want to expand the lib through my logic 
module SomeLib
    # errors: ActiveSupport::Concern::MultipleIncludedBlocks 
    included do
        puts 'executing some actions defined by me'
    end
end

那么如果在该模块中定义了一个额外包含的块,该如何定义?

0 个答案:

没有答案