Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
antulik committed Jul 9, 2024
1 parent 5cd7380 commit 8244b59
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/active_interaction/extras/nested_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ module ActiveInteraction::Extras::NestedAttributes

concern :InputsExtension do
def normalize(inputs)
@base.class.nested_attribute_options.each do |attribute, options|
alias_name = "#{attribute}_attributes"
next if !inputs.key?(alias_name) && !inputs.key?(alias_name.to_sym)
if @base.class.respond_to? :nested_attribute_options
@base.class.nested_attribute_options.each do |attribute, options|
alias_name = "#{attribute}_attributes"
next if !inputs.key?(alias_name) && !inputs.key?(alias_name.to_sym)

value = inputs[alias_name] || inputs[alias_name.to_sym]
value = @base.class.process_nested_collection(value, options)
value = inputs[alias_name] || inputs[alias_name.to_sym]
value = @base.class.process_nested_collection(value, options)

inputs[attribute.to_s] = value
inputs[attribute.to_s] = value
end
end

super
Expand Down

0 comments on commit 8244b59

Please sign in to comment.