Skip to content

Commit

Permalink
set target for all associations with avoid_changes enabled, it was ne…
Browse files Browse the repository at this point in the history
…eded for has_one associations too
  • Loading branch information
scambra committed Sep 27, 2017
1 parent 32c52fc commit 2671ef6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/active_scaffold/attribute_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def update_record_from_params(parent_record, columns, attributes, avoid_changes

def update_column_from_params(parent_record, column, attribute, avoid_changes = false)
value = column_value_from_param_value(parent_record, column, attribute, avoid_changes)
if avoid_changes && column.association.try(:collection?)
if avoid_changes && column.association
parent_record.association(column.name).target = value
elsif column.association && counter_cache_hack?(column.association, attribute)
parent_record.send "#{column.association.foreign_key}=", value.try(:id)
Expand Down

0 comments on commit 2671ef6

Please sign in to comment.