Don't save blank line items

This commit is contained in:
2026-03-07 12:49:34 -05:00
parent acd54a5e57
commit 1d29d2a816
2 changed files with 4 additions and 2 deletions

View File

@@ -13,7 +13,7 @@
<td> <td>
<%= f.number_field :quantity, <%= f.number_field :quantity,
step: 1, step: 1,
min: 1, min: 0,
style: "width:90px;", style: "width:90px;",
no_label: true, no_label: true,
disabled: readonly %> disabled: readonly %>

View File

@@ -20,7 +20,9 @@ module RedmineQboLineItems
base.class_eval do base.class_eval do
has_many :line_items, dependent: :destroy has_many :line_items, dependent: :destroy
accepts_nested_attributes_for :line_items, allow_destroy: true accepts_nested_attributes_for :line_items,
allow_destroy: true,
reject_if: proc { |attrs| attrs['description'].blank? }
end end
end end