Skip to content

Commit

Permalink
fix subform with singular association in rails 5, fixes activescaffol…
Browse files Browse the repository at this point in the history
  • Loading branch information
scambra committed May 18, 2017
1 parent 7214f1a commit 9d76a14
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/active_scaffold/attribute_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def column_value_from_param_value(parent_record, column, value, avoid_changes =
if form_ui && respond_to?("column_value_for_#{form_ui}_type", true)
send("column_value_for_#{form_ui}_type", parent_record, column, value)
elsif params_hash? value
column_value_from_param_hash_value(parent_record, column, value, avoid_changes)
column_value_from_param_hash_value(parent_record, column, params_hash(value), avoid_changes)
else
column_value_from_param_simple_value(parent_record, column, value)
end
Expand Down Expand Up @@ -205,7 +205,6 @@ def column_value_from_param_hash_value(parent_record, column, value, avoid_chang
if column.association.try :singular?
manage_nested_record_from_params(parent_record, column, value, avoid_changes)
elsif column.association.try :collection?
value = params_hash(value)
# HACK: to be able to delete all associated records, hash will include "0" => ""
values = value.values.reject(&:blank?)
values.collect { |val| manage_nested_record_from_params(parent_record, column, val, avoid_changes) }.compact
Expand Down

0 comments on commit 9d76a14

Please sign in to comment.