• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MushroomObserver / mushroom-observer / 26547492548
97%

Build:
DEFAULT BRANCH: main
Ran 28 May 2026 12:47AM UTC
Jobs 1
Files 1019
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 May 2026 12:43AM UTC coverage: 96.449%. Remained the same
26547492548

push

github

web-flow
Field helpers: Symbol + explicit value: overrides the model attribute (#4384)

* Symbol + explicit value: overrides the model attribute

Aligns `*_field(:foo, value: x)` semantics with Rails ERB's
`f.text_field :foo, value: "override"`: when the caller passes an
explicit `value:`, that value wins over whatever the form's model
attribute would have produced. Lets forms use Symbol keys for
fields whose `name=` belongs in the form's namespace but whose
value comes from somewhere other than the model — without falling
back to the String form's raw-`name=` shape.

Concrete motivation: `projects/violations/target_location_form.rb`
needed `radio_field(:location_id, *choices, value: …)` for a
Project form, but Project has no `location_id` attribute, so
Superform's Symbol path would bind to a nil-valued field and
`option_checked?` would never fire. Previous PR (#4382) left it
using the awkward `radio_field(field(:location_id).dom.name, …)`
shape — this PR simplifies that caller to the natural Symbol form.

## How it works

`resolve_field` grows a third branch: when `field_name` is a Symbol
AND `value:` is non-nil, route through `FieldProxy` with the
Superform-namespaced name (`field(field_name).dom.name`) and the
explicit value. The model lookup is bypassed. When `value:` is
nil (or omitted), Symbol path stays model-bound exactly as before.

The downstream rendering is identical to what the String path
produces — `field(:location_id).dom.name` returns
`"project[location_id]"`, FieldProxy.dom.name returns the same,
DOM ids normalize via the same `[]` → `_` path.

## Audit / regression scope

Existing Symbol + `value:` callers in MO are:

- `locations/form.rb`: `text_field(:display_name, value: @display_name, …)` —
  Location has a `display_name` accessor, model and caller value match;
  output unchanged.
- `admin/users/bonuses_form.rb`:
  `textarea_field(:val, value: model.formatted_bonuses, …)` —
  unchanged output.

Both produce identical HTML before and afte... (continued)

6 of 6 new or added lines in 2 files covered. (100.0%)

39116 of 40556 relevant lines covered (96.45%)

664.25 hits per line

Jobs
ID Job ID Ran Files Coverage
1 26547492548.1 28 May 2026 12:47AM UTC 1019
96.45
GitHub Action Run
Source Files on build 26547492548
  • Tree
  • List 1019
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #26547492548
  • 02af9065 on github
  • Prev Build on main (#26544194847)
  • Next Build on main (#26549298654)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc