HABTM :inverse_of => nil broken in 2.3.2

XMLWordPrintableJSON

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

      class Movie
       include Mongoid::Document
       has_and_belongs_to_many :ratings, :inverse_of => nil
      end
      
      class Rating
       include Mongoid::Document
      end
      
      Movie.new :ratings => [Rating.new]
      => TypeError: keys must be strings or symbols
      

      Mongoid is correctly determining there is no inverse foreign key field (so is nil), but still tries to do the update to the Rating anyway (i.e. tries to do something like

      Unable to find source-code formatter for language: update. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      (nil => movie._id)

      , hence the

      Unable to find source-code formatter for language: typeerror. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      
      

      .

              Assignee:
              Unassigned
              Reporter:
              Ben Symonds
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: