mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: properly set source on attributes
This commit is contained in:
parent
c591bf6746
commit
787cbad605
2 changed files with 5 additions and 1 deletions
|
@ -201,6 +201,10 @@ defmodule Ash.Resource.Attribute do
|
||||||
|> OptionsHelpers.set_default!(:type, :integer)
|
|> OptionsHelpers.set_default!(:type, :integer)
|
||||||
|> Keyword.delete(:allow_nil?)
|
|> Keyword.delete(:allow_nil?)
|
||||||
|
|
||||||
|
def transform(attribute) do
|
||||||
|
Ash.Type.set_type_transformation(%{attribute | source: attribute.source || attribute.name})
|
||||||
|
end
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
def attribute_schema, do: @schema
|
def attribute_schema, do: @schema
|
||||||
def create_timestamp_schema, do: @create_timestamp_schema
|
def create_timestamp_schema, do: @create_timestamp_schema
|
||||||
|
|
|
@ -12,7 +12,7 @@ defmodule Ash.Resource.Dsl do
|
||||||
end
|
end
|
||||||
"""
|
"""
|
||||||
],
|
],
|
||||||
transform: {Ash.Type, :set_type_transformation, []},
|
transform: {Ash.Resource.Attribute, :transform, []},
|
||||||
target: Ash.Resource.Attribute,
|
target: Ash.Resource.Attribute,
|
||||||
args: [:name, :type],
|
args: [:name, :type],
|
||||||
modules: [:type],
|
modules: [:type],
|
||||||
|
|
Loading…
Reference in a new issue