aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorYauheni Dakuka <yauheni.dakuka@gmail.com>2018-02-12 23:29:34 +0300
committerGitHub <noreply@github.com>2018-02-12 23:29:34 +0300
commita7b97454f8dc481a9f6725d22b56ee62f69a3417 (patch)
tree86eda7d5542ef00666498f5d501d300e7cbebfd7 /guides
parent4c615a53e0409ddddf13d48cbc328a22d0026ed2 (diff)
downloadrails-a7b97454f8dc481a9f6725d22b56ee62f69a3417.tar.gz
rails-a7b97454f8dc481a9f6725d22b56ee62f69a3417.tar.bz2
rails-a7b97454f8dc481a9f6725d22b56ee62f69a3417.zip
Change structure of AS core extensions [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_support_core_extensions.md18
1 files changed, 9 insertions, 9 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index 8e2826bb85..6c980fb0e9 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -925,6 +925,15 @@ The macros `cattr_reader`, `cattr_writer`, and `cattr_accessor` are analogous to
```ruby
class MysqlAdapter < AbstractAdapter
# Generates class methods to access @@emulate_booleans.
+ cattr_accessor :emulate_booleans
+end
+```
+
+Also, you can pass a block to `cattr_*` to set up the attribute with a default value:
+
+```ruby
+class MysqlAdapter < AbstractAdapter
+ # Generates class methods to access @@emulate_booleans with default value of true.
cattr_accessor :emulate_booleans, default: true
end
```
@@ -941,15 +950,6 @@ end
we can access `field_error_proc` in views.
-Also, you can pass a block to `cattr_*` to set up the attribute with a default value:
-
-```ruby
-class MysqlAdapter < AbstractAdapter
- # Generates class methods to access @@emulate_booleans with default value of true.
- cattr_accessor :emulate_booleans, default: true
-end
-```
-
The generation of the reader instance method can be prevented by setting `:instance_reader` to `false` and the generation of the writer instance method can be prevented by setting `:instance_writer` to `false`. Generation of both methods can be prevented by setting `:instance_accessor` to `false`. In all cases, the value must be exactly `false` and not any false value.
```ruby