class UnmodifiableRelation

Ruby on Rails 7.2.3

Since v7.2.3

Available in: v7.2.3 v8.0.4 v8.1.2

Raised when a relation cannot be mutated because it’s already loaded.

class Task < ActiveRecord::Base
end

relation = Task.all
relation.loaded? # => true

# Methods which try to mutate a loaded relation fail.
relation.where!(title: 'TODO')  # => ActiveRecord::UnmodifiableRelation
relation.limit!(5)              # => ActiveRecord::UnmodifiableRelation

Inherits from

ActiveRecord::ActiveRecordError

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close