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?

5
  • I don't see a problem, what are you expecting? I don't understand "value is not being as a key of sorts" Commented Aug 15, 2021 at 18:54
  • it should be ' value="1" ' Commented Aug 15, 2021 at 19:12
  • You should probally be using a nested route instead of a hidden input anyways. Commented Aug 15, 2021 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? Commented Aug 16, 2021 at 4:27
  • 1
    if this happen to you on firefox, reference: this, this, this Commented Aug 16, 2021 at 8:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.