Ash FrameworkAF
Ash Framework3y ago
6 replies
richaard0

Multitenancy and no_attributes? relationship option

Reading through the docs, I encountered the part about the no_attributes? option while declaring relationships.

Specifically, if you have a tenant resource like Organization , you can use no_attributes? to do things like has_many :employees, Employee, no_attributes?: true , which lets you avoid having an unnecessary organization_id field on Employee


Reading this, I was under the impression that I wouldn't have to specify a belong_to on my resource, but I encounter this error if I don't define one:

** (EXIT from #PID<0.93.0>) an exception was raised:
    ** (Spark.Error.DslError) [Vigil.Fleet.Plane]
 multitenancy -> attribute:
  Attribute airline_id used in multitenancy configuration does not exist


Am I missing something or do I still need to define a belong_to for my Plane resource?

For reference, my airline resource has the following:
    has_many :planes, Vigil.Fleet.Plane do
      api Vigil.Fleet
      no_attributes? true
    end
Was this page helpful?