Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-3951

Collision in active_support concern class_methods

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.2
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      C.f should be "ok". But when have require the mongoid, the result is xxx. mongoid and activesupport I do not know either side of the issue. Please tell me if there is a workaround.

      gem "psych", "2.0.12"
      require "psych"
      
      gem "activesupport", "4.2.0"
      require "active_support/core_ext/kernel/concern"
      
      gem "mongoid", "4.0.1"
      require "mongoid" if true       # <-- If false the result is ok
      
      class B
        def self.f
          "xxx"
        end
      end
      
      concern :M do
        class_methods do
          self                        # => Mongoid::Extensions::Object::ClassMethods
          def f
            "ok"
          end
        end
      end
      
      class C < B
        include M
      end
      
      C.f                             # => "xxx"
      

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            akicho8 akicho8
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: