mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 14:56:50 +00:00
addressing pull request comments
This commit is contained in:
parent
6a8da1f664
commit
e9f259697a
@ -1,4 +1,4 @@
|
|||||||
## Passing Arbitrary Options to A Serializer
|
## Passing Arbitrary Options To A Serializer
|
||||||
|
|
||||||
Let's say you have a basic Post Controller:
|
Let's say you have a basic Post Controller:
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ class PostSerializer < ActiveModel::Serializer
|
|||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
This works all fine and well, but maybe you passing in some "artibrary" options
|
This works all fine and well, but maybe you passing in some "arbitrary" options
|
||||||
into the serializer. Here's what you would do:
|
into the serializer. Here's what you would do:
|
||||||
|
|
||||||
### posts_controller.rb
|
### posts_controller.rb
|
||||||
@ -41,6 +41,5 @@ into the serializer. Here's what you would do:
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
These options can be anything that isn't already reserved for use by AMS. For example,
|
These options can be anything that isn't already reserved for use by
|
||||||
you won't be able to pass in a `meta` or `root` option like the example above. Those
|
ActiveModelSerializers' adapter options.
|
||||||
parameters are reserved for specific behavior within the app.
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user