docs/exclude_association.md in clowne-0.2.0 vs docs/exclude_association.md in clowne-1.0.0
- old
+ new
@@ -17,16 +17,16 @@
exclude_association :posts
end
end
# copy user and posts
-clone = UserCloner.call(user)
+clone = UserCloner.call(user).to_record
clone.posts.count == user.posts.count
# => true
# copy only user
-clone2 = UserCloner.call(user, traits: :without_posts)
+clone2 = UserCloner.call(user, traits: :without_posts).to_record
clone2.posts
# => []
```
**NOTE**: once excluded association cannot be re-included, e.g. the following cloner:
@@ -39,11 +39,12 @@
# That wouldn't work
include_association :comments
end
end
-clone = UserCloner.call(user, traits: :with_comments)
-clone.comments.empty? #=> true
+clone = UserCloner.call(user, traits: :with_comments).to_record
+clone.comments.empty?
+# => true
```
Why so? That allows us to have a deterministic cloning plan when combining multiple traits
(or inheriting cloners).