-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
Hi.
Here is the problem. Am I missing something ? Why is the array tag_ids not updated ?
Unable to find source-code formatter for language: ruby```. 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
# example taken from http://mongoid.org/en/mongoid/docs/relations.html#has_and_belongs_to_many class Band include Mongoid::Document has_and_belongs_to_many :tags, inverse_of: nil end class Tag include Mongoid::Document field :name, type: String end tag1 = tag.create! tag2 = tag.create! band = Band.create!(tags: [tag1, tag2]) puts band.tags.count == band.tag_ids.count # returns true tag1.destroy band.reload puts band.tags.count == band.tag_ids.count # returns false