spec/models/animal.rb in mongoid-eager-loading-0.2.0 vs spec/models/animal.rb in mongoid-eager-loading-0.3.0
- old
+ new
@@ -1,15 +1,18 @@
class Animal
include Mongoid::Document
field :name
- field :tags, :type => Array
+ field :tags, :type => Array
key :name
- embedded_in :person, :inverse_of => :pet
-
+
+ embedded_in :person
+
+ accepts_nested_attributes_for :person
+
def tag_list
tags.join(", ")
end
-
+
def tag_list=(_tag_list)
self.tags = _tag_list.split(",").map(&:strip)
- end
+ end
end