Skip to content

Commit 3424ac0

Browse files
committed
fix rubocop offense
1 parent eff36a1 commit 3424ac0

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/active_scaffold/helpers/form_column_helpers.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,13 @@ def form_attribute(column, record, scope = nil, only_value = false, col_class =
244244
if column.association.nil? || column.association.belongs_to?
245245
# hidden field probably not needed, but leaving it just in case
246246
# but it isn't working for assocations which are not belongs_to
247-
method = column.association ? column.association.foreign_key : column.name
248-
field << hidden_field(:record, method, column_options)
247+
field << hidden_field(:record, column.association&.foreign_key || column.name, column_options)
249248
end
250249
else
251250
field = active_scaffold_input_for column, scope, column_options, form_columns: form_columns
252251
end
253-
if field
254-
field << loading_indicator_tag(action: :render_field, id: params[:id]) if column.update_columns
255-
description = column_description(column, record, scope)
256-
end
252+
field << loading_indicator_tag(action: :render_field, id: params[:id]) if field && column.update_columns
253+
description = column_description(column, record, scope)
257254

258255
label = label_tag(label_for(column, column_options), form_column_label(column, record, scope))
259256
label << h(' ') << link_to_visibility_toggle(collapsible_id) if collapsible_id

0 commit comments

Comments
 (0)