Skip to content

Commit

Permalink
Create additional fields (after rebasing and fixing conflict)
Browse files Browse the repository at this point in the history
  • Loading branch information
binarygit committed Jul 30, 2024
1 parent a5ffba4 commit 32644f8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/avo/associations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def create
format.turbo_stream {
render turbo_stream: turbo_stream.append("alerts", partial: "avo/partials/all_alerts")
}
format.html {
redirect_back fallback_location: resource_view_response_path,
error: t("avo.attachment_failed", attachment_class: @related_resource.name)
}
end
end
end
Expand All @@ -85,7 +89,9 @@ def create_association
association_name = BaseResource.valid_association_name(@record, association_from_params)

perform_action_and_record_errors do
if reflection_class == "HasManyReflection"
if reflection.instance_of?(ActiveRecord::Reflection::ThroughReflection) && additional_params?
join_record.save
elsif reflection_class == "HasManyReflection"
@record.send(association_name) << @attachment_record
else
@record.send(:"#{association_name}=", @attachment_record)
Expand Down

0 comments on commit 32644f8

Please sign in to comment.