Checkboxes in a loop - I get the same id

<% f.fields_for :keys do |key_form| %>
<%= check_box_tag “keys_to_update[]”, key_form.object.id %>
<%= key_form.label :name, key_form.object.name %>
<% end %>

This is the output:


I try to use cucumber and check only one of them (or all of them) but
need an id.

Thanks!

what about key_form.id?

On Apr 19, 9:19 pm, oren [email protected] wrote:

This is the output:


I try to use cucumber and check only one of them (or all of them) but
need an id.

You can override the automatically generated id with anything of your
choice (the last argument to check_box_tag is a hash of html options

Fred

works, thank you!

On Apr 19, 10:32 pm, Frederick C. [email protected]