Support lowerCamel key format

This commit is contained in:
Kyle Fritz
2014-03-30 11:53:24 -04:00
parent 2e31a14125
commit 00c54baae3
8 changed files with 109 additions and 3 deletions

View File

@@ -226,6 +226,23 @@ def default_serializer_options
end
```
## Changing the Key Format
You can specify that serializers use the lower-camel key format at the config, class or instance level.
```ruby
ActiveModel::Serializer.setup do |config|
config.key_format = :lower_camel
end
class BlogLowerCamelSerializer < ActiveModel::Serializer
format_keys :lower_camel
end
BlogSerializer.new(object, key_format: :lower_camel)
```
## Getting the old version
If you find that your project is already relying on the old rails to_json