inputs_for with an array of typed_struct

I have a resource with an attribute, that is a list of typed_structs
attributes do
attribute :schedules, {:array, Schedule}`
end
attributes do
attribute :schedules, {:array, Schedule}`
end
use Ash.TypedStruct

typed_struct do
field :weekday, :integer, constraints: [min: 1, max: 7]
field :time, :time
end
use Ash.TypedStruct

typed_struct do
field :weekday, :integer, constraints: [min: 1, max: 7]
field :time, :time
end
Is it possible to use AshPhoenix.Form.add_form in a LiveLiew to add / use inputs_for in the template? If i try to follow this example https://hexdocs.pm/ash_phoenix/nested-forms.html i get the error (KeyError) key :type not found in: nil Any ideas / examples or am I using the wrong approach here? (i don't want an extra table/resource for schedules) Thanks in advance!!
Solution:
Thanks for your answer! ❤️ Good to know, so i don't run in the wrong direction here. I'll use an Embedded Resource instead. This should work with inputs_for in the LiveView. ```...
Jump to solution
2 Replies
ZachDaniel
ZachDaniel2d ago
I don't think this is possible right now, sorry
Solution
sorax
sorax17h ago
Thanks for your answer! ❤️ Good to know, so i don't run in the wrong direction here. I'll use an Embedded Resource instead. This should work with inputs_for in the LiveView.
use Ash.Resource,
data_layer: :embedded

attributes do
attribute :weekday, :integer, constraints: [min: 1, max: 7]
attribute :time, :time
end
use Ash.Resource,
data_layer: :embedded

attributes do
attribute :weekday, :integer, constraints: [min: 1, max: 7]
attribute :time, :time
end

Did you find this page helpful?