Best way to use acts_as_tenant with blueprinter gem

129 views Asked by At

I am loving using the blueprinter gem for my API, but i'm finding using it with the acts_as_tenant gem kinda cumbersome with associations. I have to pass in the account as options, which gets annoying when you have more than one association or nested associations. Is there an easier way?

class UserBlueprint < Blueprinter::Base
  fields :uuid, :name, :plan

  association :posts, blueprint: PostBlueprint do |user, options|
    ActsAsTenant.with_tenant(options[:account]) do
      user.posts
    end
  end
end
0

There are 0 answers