> For the complete documentation index, see [llms.txt](https://allfutures.leastbad.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://allfutures.leastbad.com/usage/readonly.md).

# Readonly

You can use `attr_readonly :title, :author` to prevent assign value to attribute after initialized.

You can use `enable_readonly!` and `disable_readonly!` to control the behavior.

**Important: It's no effect with embeds or array attributes !!!**

#### enable\_attr\_readonly!, disable\_attr\_readonly!

#### attr\_readonly\_enabled?

#### without\_attr\_readonly(\&blk)

#### readonly\_attribute?(attribute)

#### readonly!, readonly?

Mark the current model instance as `readonly`, which prevents any future attempts to save or update. The instance is still accessible, just frozen.

The transition to `readonly`, is one-directional and cannot be reversed. If you need to write to this instance again, you'll have to `find` it again. This is different from marking an individual attribute as `readonly`, which can be reversed.

### Class methods

#### readonly\_attributes

Returns a Set of attributes that are marked with `attr_readonly` in your All Futures class. Attributes in the Set are presented as Strings.


---

# 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, and the optional `goal` query parameter:

```
GET https://allfutures.leastbad.com/usage/readonly.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
