coalesce is a generic library for combining and aggregating ruby objects.
This can be a pretty complicated problem, and has a bunch of edge-cases.
Add this line to your application's Gemfile:
gem 'coalesce', github: 'mieko/coalesce'
And then execute:
$ bundle
Coalesce::Grouper.new(PublicActivity::Activities.all.limit(100)) do
rule :accept_and_close do
key 'ticket.accept', 'ticket.close'
combine :id, with: :array
combine :key, with: :smart_key
end
end- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request