millions-exabyte-27721
04/22/2025, 2:45 PMboolean_group field type, specifically computed options:
I found that if I try to update a record from computed options derived from the record it does not work. I chased that down to the fact that when I add a breakpoint in the field's computed options lambda and issue a PUT, there, record is nil:
rb
field :event_roles,
as: :boolean_group,
options: -> do
binding.irb
record&.event&.roles || {}
end
=>
irb(#<Avo::ExecutionContext:0x000...):007> record
=> nil
note that this is not the case when it's called regularly from the edit view. it also works as expected with options supplied as a regular hashmillions-exabyte-27721
04/22/2025, 3:16 PMrecord is nil here: https://github.com/avo-hq/avo/blob/main/lib/avo/fields/boolean_group_field.rb#L11
when in the update actionmillions-exabyte-27721
04/22/2025, 3:17 PMmillions-exabyte-27721
04/22/2025, 3:23 PMnil to `@record`:
https://github.com/avo-hq/avo/blob/main/app/controllers/avo/base_application_controller.rb#L192loud-jewelry-99127
04/22/2025, 3:23 PMloud-jewelry-99127
04/22/2025, 3:24 PMresource.recordmillions-exabyte-27721
04/22/2025, 3:24 PMmillions-exabyte-27721
04/22/2025, 3:25 PMloud-jewelry-99127
04/22/2025, 3:25 PMloud-jewelry-99127
04/22/2025, 3:39 PMloud-jewelry-99127
04/23/2025, 10:26 AM