I have a keychain object. keychain has_many credentials.
I'm trying to write the view code to add a new credential to a keychain. This is the code I have:
<% form_for(@keychain) do |f| %>
<tr>
<td><%= f.select "credentials[]", current_account.services.collect{ |s|
[s.friendly_name, s.id] } %></td>
<td><%= f.text_field 'credentials', :username %></td>
<td><%= f.password_field 'credentials', :password %></td>
</tr>
<% end %>
But it fails with this message:
NoMethodError in Keychains#new Showing app/views/keychains/_keychain_form.html.erb where line #32 raised: undefined method `credentials[]' for #
What am I doing wrong?