aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_support_core_extensions.md
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2016-06-15 20:35:16 -0700
committerPrathamesh Sonpatki <csonpatki@gmail.com>2016-06-15 20:35:16 -0700
commitd66a3fe8c0b5977c8c7bbff878b549fb4f01a95c (patch)
tree71280fa77bac72784926c86dbbe0a574c1558fee /guides/source/active_support_core_extensions.md
parentf9a29680682fe8c84ea634157927b9826cbf669f (diff)
downloadrails-d66a3fe8c0b5977c8c7bbff878b549fb4f01a95c.tar.gz
rails-d66a3fe8c0b5977c8c7bbff878b549fb4f01a95c.tar.bz2
rails-d66a3fe8c0b5977c8c7bbff878b549fb4f01a95c.zip
[ci skip] When instance_reader is false, attribute can still be assigned by the instance objects
Diffstat (limited to 'guides/source/active_support_core_extensions.md')
-rw-r--r--guides/source/active_support_core_extensions.md3
1 files changed, 2 insertions, 1 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index 565c87c4b5..e0b6f2f820 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -954,7 +954,8 @@ class A
class_attribute :x, instance_reader: false
end
-A.new.x = 1 # NoMethodError
+A.new.x = 1
+A.new.x # NoMethodError
```
For convenience `class_attribute` also defines an instance predicate which is the double negation of what the instance reader returns. In the examples above it would be called `x?`.