We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ac07de commit 226cbc4Copy full SHA for 226cbc4
README.md
@@ -236,6 +236,18 @@ end
236
BlogSerializer.new(object, key_format: :lower_camel)
237
```
238
239
+## Changing the default association key type
240
+
241
+You can specify that serializers use unsuffixed names as association keys by default.
242
243
+`````ruby
244
+ActiveModel::Serializer.setup do |config|
245
+ config.default_key_type = :name
246
+end
247
+````
248
249
+This will build association keys like `comments` or `author` instead of `comment_ids` or `author_id`.
250
251
## Getting the old version
252
253
If you find that your project is already relying on the old rails to_json
0 commit comments