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

id extraction conversion fails for a custom-named belongs_to

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:
      None

      Description

      I have:

      belongs_to :current_trip, class_name: 'Trip', inverse_of: nil, autosave: false
      

      Then,

      update_attribute(:current_trip, trip)
      

      generates

      update={"$set"=>{"current_trip_id"=>#<Trip _id: 50....
      

      and raises a {{NoMethodError (undefined method }}bson_dump' for #<Trip:0x007fd64a995fe8>)`
      whereas

      update_attribute(:current_trip, trip.id)
      

      works fine and generates

      update={"$set"=>{"current_trip_id"=>"50f....
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            emirkin Eugene Mirkin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: