Skip to content

Commit 7f26195

Browse files
committed
Merge pull request #1481 from wagenet/patch-2
Namespace is included in auto-registered adapters
2 parents 592a5db + efdd466 commit 7f26195

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/general/adapters.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ If a symbol, then the adapter must be, e.g. `:great_example`,
122122
There are two ways to register an adapter:
123123

124124
1) The simplest, is to subclass `ActiveModel::Serializer::Adapter::Base`, e.g. the below will
125-
register the `Example::UsefulAdapter` as `:useful_adapter`.
125+
register the `Example::UsefulAdapter` as `"example/useful_adapter"`.
126126

127127
```ruby
128128
module Example
@@ -131,10 +131,10 @@ module Example
131131
end
132132
```
133133

134-
You'll notice that the name it registers is the class name underscored, not the full namespace.
134+
You'll notice that the name it registers is the underscored namespace and class.
135135

136136
Under the covers, when the `ActiveModel::Serializer::Adapter::Base` is subclassed, it registers
137-
the subclass as `register(:useful_adapter, Example::UsefulAdapter)`
137+
the subclass as `register("example/useful_adapter", Example::UsefulAdapter)`
138138

139139
2) Any class can be registered as an adapter by calling `register` directly on the
140140
`ActiveModel::Serializer::Adapter` class. e.g., the below registers `MyAdapter` as

0 commit comments

Comments
 (0)