Here is the (Partial) code in the _form.html.erb:
—code fragment—
<%= form_for(@order) do |f| %>
<% if @order.errors.any? %>
<%= pluralize(@order.errors.count, “error”) %> prohibited this
order from being saved:
<ul>
<% @order.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= select_tag(:Client,
options_from_collection_for_select(Client.all, :id, :Company_Name))%>
---end code fragment---
This is the error:
—server log ----
Parameters: {“utf8”=>“✓”,
“authenticity_token”=>“crNdvzlzzYskmxgmITfYMLHoR49/xYFmZ8NGhK/SwOk=”,
“Client_ID”=>“2”, “order”=>{“Product_ID”=>“1”, “Flats”=>“100”,
“Order_date(1i)”=>“2010”, “Order_date(2i)”=>“11”,
“Order_date(3i)”=>“16”, “Due_date(1i)”=>“2010”, “Due_date(2i)”=>“11”,
“Due_date(3i)”=>“16”, “Ship_date(1i)”=>“2010”, “Ship_date(2i)”=>“11”,
“Ship_date(3i)”=>“16”, “Status”=>“P”}, “commit”=>“Update Order”,
“id”=>“2”}
----end server log—
Note that the variable “Client_ID”=>“2” is not inside the update order
string, so, the value is not saved in the database table for record 2.
Erick C. wrote in post #961955:
Here is the (Partial) code in the _form.html.erb:
—code fragment—
<%= form_for(@order) do |f| %>
<% if @order.errors.any? %>
<%= pluralize(@order.errors.count, “error”) %> prohibited this
order from being saved:
<ul>
<% @order.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= select_tag(:Client,
options_from_collection_for_select(Client.all, :id, :Company_Name))%>
---end code fragment---
This is the error:
—server log ----
Parameters: {“utf8”=>“✓”,
“authenticity_token”=>“crNdvzlzzYskmxgmITfYMLHoR49/xYFmZ8NGhK/SwOk=”,
“Client_ID”=>“2”, “order”=>{“Product_ID”=>“1”, “Flats”=>“100”,
“Order_date(1i)”=>“2010”, “Order_date(2i)”=>“11”,
“Order_date(3i)”=>“16”, “Due_date(1i)”=>“2010”, “Due_date(2i)”=>“11”,
“Due_date(3i)”=>“16”, “Ship_date(1i)”=>“2010”, “Ship_date(2i)”=>“11”,
“Ship_date(3i)”=>“16”, “Status”=>“P”}, “commit”=>“Update Order”,
“id”=>“2”}
----end server log—
Note that the variable “Client_ID”=>“2” is not inside the update order
string, so, the value is not saved in the database table for record 2.
All the capital letters seem odd, and are probably preventing Rails from
mapping things correctly. Every capital letter in that example should
be lowercase.
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
On 17 November 2010 20:51, Marnen Laibow-Koser [email protected]
wrote:
<% @order.errors.full_messages.each do |msg| %>
"Ship_date(3i)"=>"16", "Status"=>"P"}, "commit"=>"Update Order",
"id"=>"2"}
----end server log---
Note that the variable “Client_ID”=>“2” is not inside the update order
string, so, the value is not saved in the database table for record 2.
All the capital letters seem odd, and are probably preventing Rails from
mapping things correctly. Every capital letter in that example should
be lowercase.
Except Client.all, but that should not be in the view at all, it is
bad practice to call model code from the view, set up
@clients_for_selection or whatever in the controller.
Colin