Guides > Serializers
Serializers
Includes any class that has ActiveModel::Serializer
as one of its parent classes.
Extending a Base ApplicationSerializer
To share behavior across your serializers you can create an
ApplicationSerializer
at app/serializers/application_serializer.rb
:
class ApplicationSerializer < ActiveModel::Serializer
# Your amazing customizations here
end
Then any newly-generated serializers will automatically descend from
ApplicationSerializer
.
$ rails g serializer post
Now generates:
class PostSerializer < ApplicationSerializer
attributes :id
end
`
Generators 
Use these to quickly create serializers.
Methods
Serializers can utilize all of the following:
Attributes 
Associations 
Caching 
Scope - Authorization 
Adapter Specific 
Overriding 
What you need to know to customize your serializers.