1

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
Ashbury
  • 2,160
  • 3
  • 27
  • 52

0 Answers0