Skip to content
How-to guides and worked examplesSee the guides →

ID API ​

Per-option reference for the ID field. For tasks and examples, see the ID guide.

Declare the field in your resource's fields method, for example in app/avo/resources/user.rb:

ruby
field :id, as: :id

Defaults and value behavior ​

The ID field reads the declared attribute through the shared field value pipeline. With the declaration above, it displays the record's id; it does not generate or assign an identifier. Shared value overrides and display formatters still apply.

BehaviorDefault
Label"ID", unless a custom name is supplied
SortingEnabled (sortable: true)
ViewsDisplayed on Index and Show; hidden on forms
Read-onlyAlways enabled; readonly: false is overridden
Index renderingPlain text unless field-level or global linking is enabled
Show renderingThe field value, without a record link

For shared configuration, including name, sortable, visibility, and value formatting, see Field options.

Record linking ​

Makes the displayed value on Index link to the record's Show page. It does not affect the Show view.

ruby
field :id, as: :id, link_to_record: true
  • Type: Boolean, interpreted using Ruby truthiness after blank values fall back to false.
  • Default: false

The Index component enables linking when either this option or config.id_links_to_resource is truthy. The global setting defaults to false; setting this field option to false does not override an enabled global setting.

Boolean strings

The option does not parse Boolean strings. A nonblank string such as "false" enables linking.