> For the complete documentation index, see [llms.txt](https://whl.gitbook.io/masterrr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whl.gitbook.io/masterrr/active-storage.md).

# Active Storage

Active Storage

### Configuration

Active Storage uses config/storage.yml file to understand how and where to store uploaded files. If the file doesn't exist, you can create one:

local:

service: Disk

root: <%= Rails.root.join("storage") %>

temporary:\
service: Disk\
root: <%= Rails.root.join("tmp/storage") %>

One stores it in the directory storage, the other stores it in tmp/storage.

#### Use Amazon S3

amazon:

service: S3

access\_key\_id: <%= Rails.application.credentials.dig(:aws, :access\_key\_id) %>

secret\_access\_key: <%= Rails.application.credentials.dig(:aws, :secret\_access\_key) %>

region: us-east-1

bucket: your-bucket-name

After creating or modifying this file, you should also check your environment configuration files (like \`config/environments/development.rb\`) to ensure Active Storage is using the correct service. For example, if you're using local disk storage, you would add this line:

Config/environments/development.rb, to store files in a local folder config.active\_storage.service = :local

Config/environments/test.rb, to store files in a temporary folder

config.active\_storage.service = :temporary

Don’t forget to add /storage to your .gitignore.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://whl.gitbook.io/masterrr/active-storage.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.
