AshPrefixedId.Transformers.BelongsToAttribute (ash_prefixed_id v0.2.0)
View SourceAutomatically updates FK attributes with the correct ObjectId type for
belongs_to relationships pointing to AshPrefixedId resources.
Without this transformer, users must manually specify:
belongs_to :post, Post, attribute_type: Post.ObjectIdWith this transformer, the attribute_type is inferred automatically:
belongs_to :post, Post # attribute_type set to Post.ObjectId automaticallyImplementation Note
This is registered as a transformer but conceptually acts as a post-processing
step. It runs after Ash's BelongsToAttribute transformer has created the FK
attributes, and after the DefineType persister has created ObjectId modules.
For self-referential relationships, the ObjectId module is created by the
DefineType persister in the same compilation unit.
Summary
Functions
Callback implementation for Spark.Dsl.Transformer.after?/1.
Callback implementation for Spark.Dsl.Transformer.after_compile?/0.
Callback implementation for Spark.Dsl.Transformer.before?/1.
Callback implementation for Spark.Dsl.Transformer.transform/1.
Functions
Callback implementation for Spark.Dsl.Transformer.after?/1.
Callback implementation for Spark.Dsl.Transformer.after_compile?/0.
Callback implementation for Spark.Dsl.Transformer.before?/1.
Callback implementation for Spark.Dsl.Transformer.transform/1.