From 7a36dc736f6094322dc8bbcf3c98c1cf185d78af Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 26 Oct 2012 13:40:24 -0500 Subject: [PATCH] update AR::ImmutableRelation documentation [ci skip] --- activerecord/lib/active_record/errors.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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