Fix Markdown to adapters documentation

This commit is contained in:
Bruno Bacarini 2015-09-13 11:21:46 -03:00
parent 2789a579e8
commit 9aa237adc2

View File

@ -26,7 +26,11 @@ resources in the `"included"` member when the resource names are included in the
```ruby ```ruby
render @posts, include: ['authors', 'comments'] render @posts, include: ['authors', 'comments']
# or ```
or
```ruby
render @posts, include: 'authors,comments' render @posts, include: 'authors,comments'
``` ```
@ -91,11 +95,13 @@ ActiveModel::Serializer::Adapter.register(:special_adapter, MyAdapter)
### Looking up an adapter ### Looking up an adapter
| `ActiveModel::Serializer::Adapter.adapter_map` | A Hash of all known adapters { adapter_name => adapter_class } | | Method | Return value |
| `ActiveModel::Serializer::Adapter.adapters` | A (sorted) Array of all known adapter_names | | :------------ |:---------------|
| `ActiveModel::Serializer::Adapter.lookup(name_or_klass)` | The adapter_class, else raises an `ActiveModel::Serializer::Adapter::UnknownAdapter` error | | `ActiveModel::Serializer::Adapter.adapter_map` | A Hash of all known adapters `{ adapter_name => adapter_class }` |
| `ActiveModel::Serializer::Adapter.adapter_class(adapter)` | delegates to `ActiveModel::Serializer::Adapter.lookup(adapter)` | | `ActiveModel::Serializer::Adapter.adapters` | A (sorted) Array of all known `adapter_names` |
| `ActiveModel::Serializer.adapter` | a convenience method for `ActiveModel::Serializer::Adapter.lookup(config.adapter)` | | `ActiveModel::Serializer::Adapter.lookup(name_or_klass)` | The `adapter_class`, else raises an `ActiveModel::Serializer::Adapter::UnknownAdapter` error |
| `ActiveModel::Serializer::Adapter.adapter_class(adapter)` | Delegates to `ActiveModel::Serializer::Adapter.lookup(adapter)` |
| `ActiveModel::Serializer.adapter` | A convenience method for `ActiveModel::Serializer::Adapter.lookup(config.adapter)` |
The registered adapter name is always a String, but may be looked up as a Symbol or String. The registered adapter name is always a String, but may be looked up as a Symbol or String.
Helpfully, the Symbol or String is underscored, so that `get(:my_adapter)` and `get("MyAdapter")` Helpfully, the Symbol or String is underscored, so that `get(:my_adapter)` and `get("MyAdapter")`