-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: 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
.