0

The following

<%= form_with scope: :section, url: sections_path, remote: true do |form| %>
  <%= form.hidden_field :site_id, value: @site.id %><%= @site.id %>

is rendering

<input value="qeqe3ECw2R6GPikD9KyBHkhAb9UMdddOPzpB8tAp7yjFaHqZs/NX6Mu/i7ajW5StsGsU0AlXg831Jo7QLCgMWg==" type="hidden" name="section[site_id]" id="section_site_id">
1

Thus the @site.id is being recognized and rendered in the view, but in the input element, the value is not being as a key of sorts.

Where is this syntax awry?

Jerome
  • 5,583
  • 3
  • 33
  • 76
  • I don't see a problem, what are you expecting? I don't understand "value is not being as a key of sorts" – Les Nightingill Aug 15 '21 at 18:54
  • it should be ' value="1" ' – Jerome Aug 15 '21 at 19:12
  • You should probally be using a nested route instead of a hidden input anyways. – max Aug 15 '21 at 19:42
  • @Jerome to debug this... try putting a fixed value in the hidden field `value: '66'` and see what the result is. Same result? Then I would dig into ActionView and put a debugger statement to see what it thinks it's getting. Is there a second instance of this hidden field in the form, with the same name but different value? – Les Nightingill Aug 16 '21 at 04:27
  • 1
    if this happen to you on firefox, reference: [this](https://github.com/rails/rails/issues/42610), [this](https://bugzilla.mozilla.org/show_bug.cgi?id=1667657), [this](https://stackoverflow.com/a/63794110/12219679) – Lam Phan Aug 16 '21 at 08:19

0 Answers0