• Type: Icon: Task Task
    • Resolution: Done
    • 3.0.6
    • Affects Version/s: None
    • Component/s: None

      I'm having an issue with the has_and_belongs_to_many relation. I can't seem to retrieve the relation objects through their instances.

      The code:

      class User
        include Mongoid::Document
      
        has_and_belongs_to_many :badges
      end
      
      class Badge
        include Mongoid::Document
      
        has_and_belongs_to_many :users
      end
      

      The code i'm testing it:

      Badge.first # #<Badge _id: 50467bd226613b7f66000001, ... , user_ids: ["50478de726613be123000003", "50478e7026613be123000006"]>
      
      User.find("50478de726613be123000003").badges # [] empty
      

            Assignee:
            durran Durran Jordan
            Reporter:
            lukelex lukelex
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: