aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/errors.rb
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-10-26 13:40:24 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-10-26 13:40:53 -0500
commit7a36dc736f6094322dc8bbcf3c98c1cf185d78af (patch)
tree64cbd4e791b19869f1cb362c3a5635c3101e44bb /activerecord/lib/active_record/errors.rb
parentb1e5c1660b40688993f3ed151143a26da55082db (diff)
downloadrails-7a36dc736f6094322dc8bbcf3c98c1cf185d78af.tar.gz
rails-7a36dc736f6094322dc8bbcf3c98c1cf185d78af.tar.bz2
rails-7a36dc736f6094322dc8bbcf3c98c1cf185d78af.zip
update AR::ImmutableRelation documentation [ci skip]
Diffstat (limited to 'activerecord/lib/active_record/errors.rb')
-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