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

Getting 'Missing Attribute error' after updating mongoid

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 5.1.2
    • Affects Version/s: 5.1.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Rails 4.2.5.2
      gem mongoid-5.1.1

      So I have a model like so:

      class PlacementData
      store_in collection: 'events' , database: 'dev'
      field :pid, type: Integer
      field :eventData, type: Hash
      field :primary, type: Hash
      ....
      end

      In rails console, the following was working in Mongoid v3
      > PlacementData.where(pid: 1).first.eventData
      But after updating mongoid to 5.1.1 I get the following error:

      Missing attribute

      I managed to dirty mix fix it by creating this method:

      def eventData
      self.attributes['eventData']
      end

      but Im quite annoyed I cant call eventData on a placement_data instance like I used to. You guys have any idea what could be wrong?

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            violentr Deniss
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: