
Claude was finally smarter than me
Elixir, Phoenix, Ash project Got 100's of text fields spread across 20+ Ash Resources. Finally got around to enforcing some sane max_length constraints on them. Simple prompt, "Add sane max_length constraints to all Ash Resource text fields, based on their implied meaning" Few minutes later, it was done, and after a quick review there weren't any changes needed. Next up, add that same max_length as maxlength on the corresponding inputs fields. Simple prompt: "Now apply those max_length constraints to the field's corresponding input boxes" Which I thought I was going to get 100+ edits. Well, wrong. It thought for 30s or so, and ultimately made a nice simple change in one place, core_components.ex def input(%{field: %FormField{} = field} = assigns) do errors = if Phoenix.Component.used_input?(field), do: field.errors, else: [] assigns |> assign(field: nil, id: assigns.id || field.id) ... |> maybe_inject_maxlength(field) |> input() end ... @maxlength_types ~w(text email tel url search tex
Continue reading on Dev.to
Opens in a new tab



