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

Inverses aren't found for embedded association in modules

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Associations
    • Labels:

      Gives those classes :

      module Blog
        class Article
          include Mongoid::Document
          embeds_many :comments
        end
      
        class Comment
          include Mongoid::Document
          embedded_in :article
        end
      end
      

      Blog::Article.relations[:comments].inverse and Blog::Comment.relations[:article].inverse give nil because, at this line, rel.relation_class_name gives "Article" and inverse_class_name gives "Blog::Article". At this line, rel.relation_class_name gives "Comment" and inverse_class_name gives "Blog::Comment".

      Maybe those lines have to be changed to :

      rel.relation_class_name.sub(/\A::/, '') == inverse_class_name.sub(/\A::/, '')
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            guirec.corbel@gmail.com Guirec Corbel
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: