As I couldn’t find the library for working with external resources in
Rails, I made this gem:
A long time ago I thought that that’s what ActiveResource id for, but:
- There is no system of associations between ActiveResource models and
- ActiveResource has a lot of features related to modifying external
resources, but I never found it particularly useful. Usually I just want
“enrich” my models with some content fetched from some (usually
To make it more clear, what you can use it for, here’s an example:
class User < ApplicationRecord
integrates :relation, requires: [:with]
def self.integrative_find(ids, integration) Friend.where(user_id: integration.call_options[:with].id,
User.where(public: true).integrate(:relation, with:
The above code would fetch Friend models only once.
All feedback is welcome.