# file-io

Things regarding the input and output in a rials application.

## Table of Contents

* [Importing CSV Files](/ruby-on-rails/file-io.md#importing-csv-files)

## Importing CSV Files

Rails has a lot of support built on for handling CSV (both, in- and output), have a look at the [CSV Class](https://ruby-doc.org/stdlib-2.0.0/libdoc/csv/rdoc/CSV.html).

While importing CSV Files, the most memory-efficient method is to use `CSV.foreach()`, which reads the file line per line (see [this article](https://dalibornasevic.com/posts/68-processing-large-csv-files-with-ruby) for more information about the performance of importing CSV files).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.christianpoplawski.de/ruby-on-rails/file-io.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
