mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
update AR::ImmutableRelation documentation [ci skip]
This commit is contained in:
parent
b1e5c1660b
commit
7a36dc736f
1 changed files with 14 additions and 0 deletions
|
@ -193,6 +193,20 @@ module ActiveRecord
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Raised when a relation cannot be mutated because it's already loaded.
|
||||||
|
#
|
||||||
|
# class Task < ActiveRecord::Base
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# relation = Task.all
|
||||||
|
# relation.loaded? # => true
|
||||||
|
#
|
||||||
|
# # where! will try to mutate the relation, but this will fails because it's loaded
|
||||||
|
# relation.where!(title: 'TODO')
|
||||||
|
# # => ActiveRecord::ImmutableRelation
|
||||||
|
#
|
||||||
|
# relation.limit!(5)
|
||||||
|
# # => ActiveRecord::ImmutableRelation
|
||||||
class ImmutableRelation < ActiveRecordError
|
class ImmutableRelation < ActiveRecordError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue