README.md in acb-0.1.5 vs README.md in acb-0.2.0
- old
+ new
@@ -59,9 +59,26 @@
[:user, :comments]
end
end
PostCsvBuilder.new(user_id).to_csv
+
+# or
+
+class PostCsvBuilder
+ include Acb
+
+ add_column name: 'id'
+ add_column name: 'User Name', index: 'user.name'
+ add_column name: 'created_at', format: '%Y-%m-%d'
+ add_column name: 'Comment Amount', index: 'comments.size'
+ add_column name: 'First Comment', index: ->(post) { post.comments.first&.content }
+end
+
+builder = PostCsvBuilder.new
+relations = Post.where(user_id: user_id).preload(:user, :comments)
+builder.load_from(relations)
+builder.to_csv
```
## Code of Conduct
Everyone interacting in the Acb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kakubin/acb/blob/main/CODE_OF_CONDUCT.md).