If anyone is trying to figure out how to add/edit a nested attribute in a Rails 5 attributes hash, I found this to be the most straight-forward (alternate) approach. Don't bother with merge or deep_merge...it's a pain due to the strong parameters. In this example, I needed to copy the group_id and vendor_id to the associated invoice (nested parameters) prior to saving.
def create
my_params = order_params
@order = Order.new
@order.attributes = my_params
@order.invoice.group_id = my_params[:group_id]
@order.invoice.vendor_id = my_params[:vendor_id]
@order.save
end
private
# Permit like normal
def order_params
params.require(:order).permit([:vendor_id, :group_id, :amount, :shipping,:invoice_attributes => [:invoice_number, :invoice_date, :due_date, :vendor_id, :group_id]])
end