Skip to content

Commit

Permalink
fix has one through, it works with normal assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
scambra committed Jun 12, 2017
1 parent 0c28cd8 commit 2901c9d
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 @@ -121,7 +121,7 @@ def update_column_from_params(parent_record, column, attribute, avoid_changes =
elsif column.association && counter_cache_hack?(column.association, attribute)
parent_record.send "#{column.association.foreign_key}=", value.try(:id)
parent_record.association(column.name).target = value
elsif column.association && column.association.through? && !column.association.through_reflection.collection?
elsif column.association.try(:collection?) && column.association.through? && !column.association.through_reflection.collection?
through = column.association.through_reflection.name
through_record = parent_record.send(through)
through_record ||= parent_record.send "build_#{through}"
Expand Down

0 comments on commit 2901c9d

Please sign in to comment.