rom-rb / rom

Data mapping and persistence toolkit for Ruby
https://rom-rb.org
MIT License
2.08k stars 161 forks source link

Remove `Repository::Root#aggregate` method #510

Closed v-kolesnikov closed 5 years ago

v-kolesnikov commented 5 years ago

Remove Repository::Root#aggregate in favor of Relation#combine

Upgrade example:

ROM 4.x

class Users < ROM::Repository::Root[:users]
  def list
    aggregate(tasks: :tags).to_a
  end
end

ROM 5.x

class Users < ROM::Repository::Root[:users]
  def list
    users
      .combine(tasks: :tags)
      .to_a
  end
end
timriley commented 5 years ago

This looks good to me, thanks @v-kolesnikov. I'll let @solnic or @flash-gordon have final say before merging in this case, though.

If I could offer any suggestion here, it's that I'd want to put a description for the empty it example inside the "with nested nodes" spec example, just for consistency :)

v-kolesnikov commented 5 years ago

@timriley Thank you for the review!

solnic commented 5 years ago

@v-kolesnikov thanks, could you also add a deprecation warning that this method goes away to release-4.2 branch?

v-kolesnikov commented 5 years ago

@v-kolesnikov thanks, could you also add a deprecation warning that this method goes away to release-4.2 branch?

👌