diff --git a/app/models/quantity.rb b/app/models/quantity.rb index ebb22dd..985c2bc 100644 --- a/app/models/quantity.rb +++ b/app/models/quantity.rb @@ -62,7 +62,7 @@ class Quantity < ApplicationRecord name end - def movable? + def destroyable? subquantities.empty? end diff --git a/app/views/quantities/_quantity.html.erb b/app/views/quantities/_quantity.html.erb index 1ee0efa..c5d5d89 100644 --- a/app/views/quantities/_quantity.html.erb +++ b/app/views/quantities/_quantity.html.erb @@ -17,13 +17,9 @@ <%= image_link_to t('.new_subquantity'), 'plus-outline', new_quantity_path(quantity), id: dom_id(quantity, :new, :link), onclick: 'this.blur();', data: {turbo_stream: true} %> - <%= image_button_to_if quantity.movable?, t('.destroy'), 'delete-outline', + <%= image_button_to_if quantity.destroyable?, t('.destroy'), 'delete-outline', quantity_path(quantity), method: :delete %> - <% if quantity.movable? %> -