What is the expected output when I add skip_hidden: true option in inputs_for?
For example in this code:
<%= form_for @changeset, "/some_path", [as: :password], fn f -> %>
<%= hidden_input f, :hashed_password_reset_token, value: @token %>
<%= inputs_for f, :authorizations, [skip_hidden: true], fn po -> %>
<%= input po, :password, "New Password" %>
<%= input po, :password_confirmation, "Confirm New Password" %>
<%= hidden_input po, :reset_password, value: true %>
<% end %>
<%= submit "Submit" %>
<% end %>
I thought it will hide the reset_password field in the rendered HTML but it seems it still appears. And I also noticed that when there is a skip_hidden option it will omit the id from authorizations inside the password params.
Hidden ids are generated by default by inputs_for and they are mostly useful when the User is editing the form. In order to proper update your changeset + nested children they must to be sent by the client.
This option skip_hidden is useful when you want more control on how those hidden ids will be generated. See the original issue:
That’s what this option is for. I guess if you don’t want to generate some input even though it’s hidden, you need to explicitly handle it with some condition.