aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/errors.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb
index 0637dd58b6..f039c23675 100644
--- a/activerecord/lib/active_record/errors.rb
+++ b/activerecord/lib/active_record/errors.rb
@@ -193,6 +193,20 @@ module ActiveRecord
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
end