我在rails console中有这样的代码:
module Taggable
extend ActiveSupport::Concern
module ClassMethods
def taggable?
false
end
end
end
当我跑步时:
ActiveRecord::Base.send :include, Taggable
。我看到这个方法可以标记吗?将成为singleton_class的instance_methods:ActiveRecord::Base.singleton_class.instance_methods.include? :taggable? # => true
。但是当我跑
ActiveRecord::Base.extend Taggable
时。我不知道这个方法可以标记在哪里?在?ActiveRecord::Base.singleton_class.methods.include? :taggable? # => false
请帮我理解。