<%= form_for(@entry, url:entries_new_path) do |f| %>
<table>
<tr>
<th>Description</th>
<th>Date</th>
<th>Debit Amount</th>
<th>Debit Account</th>
<th>Credit Amount</th>
<th>Credit Account</th>
</tr>
<tr>
<td><%= f.text_field :description %></td>
<td><%= f.date_select :date %></td>
<td><%= text_field Plutus::DebitAmount, :debit_amount %></td>
<td><%= collection_select(Plutus::Account, :id, Plutus::Account.all, :id, :name, :prompt => true) %></td>
<td><%= text_field Plutus::CreditAmount, :credit_amount %></td>
<td><%= collection_select(Plutus::Account, :id, Plutus::Account.all, :id, :name, :prompt => true) %></td>
</tr>
</table>
<br />
<%= f.submit "Create new entry", class: "btn btn-primary" %>
<% end %>
Notice the "f" removed from the collection_selects and text_fields for the inherited parameters (because Rails complained I couldn't act on the @entry if I kept them. This produces an entry assembly that doesn't work:
Output:
Parameters: {"utf8"=>"✓", "authenticity_token"=>"GNq+RmAQLbczxb0SpYI9m0qF8XvQwdZoOGuQoajfJh3SUqsz76durN/mLR3I/Nw6xFdH8U+Trw2cEOvbZlq+hQ==",
"entry"=>{"description"=>"Order placed for widgets", "date(1i)"=>"2018", "date(2i)"=>"8", "date(3i)"=>"7"},
"Plutus::DebitAmount"=>{"debit_amount"=>"100"},
"Plutus::Account"=>{"id"=>"6"}, "Plutus::CreditAmount"=>{"credit_amount"=>"100"},
"commit"=>"Create new entry"}
entry = Plutus::Entry.new(
:description => "Order placed for widgets",
:date => Date.yesterday,
:debits => [{:account_name => "Cash", :amount => 100.00}],
:credits => [{:account_name => "Unearned Revenue", :amount => 100.00}])
entry.save