Simplify object and association checks

* check for <object> instead of <object>.nil?
* check for <association>_id? instead of <association>.nil? (avoids
  record loading)
This commit is contained in:
2025-01-16 20:42:18 +01:00
parent c908063212
commit 7962cdf169
13 changed files with 24 additions and 26 deletions

View File

@@ -14,7 +14,7 @@
<% if current_user.at_least(:active) %>
<td class="actions">
<% if unit.base.nil? %>
<% unless unit.base_id? %>
<%= image_link_to t('.new_subunit'), 'plus-outline', new_unit_path(unit),
id: dom_id(unit, :new, :link), onclick: 'this.blur();', data: {turbo_stream: true} %>
<% end %>