Hey guys! Has anyone experienced this problem?
>> When I set a field to read-only after assigning a value to it:
field :user, as: :belongs_to, default: -> { Avo::App.context[:current_user].id }, readonly: true
-------------------
>> Avo reports the following message when trying to save
- You might have missed something. Please check the form.
- Validation failed: User must exist
>> Although Avo indicates the presence of a mandatory field, the system saves the record normally,
>> as if it had not given any validation error
-------------------
>> Looks like Avo doesn't accept receiving parameter set to read-only
Started POST "/avo/resources/schedulings?via_relation=room&via_relation_class=Room&via_resource_id=4" for 127.0.0.1 at 2023-03-31 12:08:35 -0300
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 1], ["LIMIT", 1]]
Processing by Avo::SchedulingsController#create as TURBO_STREAM
Parameters: {"authenticity_token"=>"[FILTERED]", "via_resource_id"=>"4", "via_relation"=>"room", "scheduling"=>{"room_id"=>"4", "user_id"=>"1", "booked_at"=>"2023-04-02T13:00:00.000-03:00", "booked_for"=>"8"}, "fake_booked_at"=>{"fake"=>"2023-04-02 13:00:00"}, "button"=>"", "via_relation_class"=>"Room"}
Unpermitted parameter: :user_id. Context: { controller: Avo::SchedulingsController, action: create, request: #
, params: {"authenticity_token"=>"[FILTERED]", "via_resource_id"=>"4", "via_relation"=>"room", "scheduling"=>{"room_id"=>"4", "user_id"=>"1", "booked_at"=>"2023-04-02T13:00:00.000-03:00", "booked_for"=>"8"}, "fake_booked_at"=>{"fake"=>"2023-04-02 13:00:00"}, "button"=>"", "via_relation_class"=>"Room", "controller"=>"avo/schedulings", "action"=>"create"} }
-------------------
>> However, when I remove the read-only setting, the system saves normally, without error message
field :user, as: :belongs_to, default: -> { Avo::App.context[:current_user].id }