mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Grape formatter feature requested in #1258
- adds handling for when the returned resource is not serializable via ams - fix for when resource is an Array - Moves grape include to grape namespace. Changes Enumerable to Array because a plain hash is enumerable. - Add integration test - Refine scope of Grape version dependency - Assert that the response is equal to a manually defined JSON string - Add single module to include in Grape projects - Create a Serializable Resource to test rails-api from Grape - Update docs - Fix discrepency between ActiveRecord 4.0 - 4.1 and 4.2 - Updated Changelog - Remove parens from `render`, use `serializable` in all tests.
This commit is contained in:
committed by
John Hamelink
parent
614e349502
commit
d85a17bb33
@@ -23,7 +23,7 @@ This is the documentation of AMS, it's focused on the **0.10.x version.**
|
||||
|----|-----|----
|
||||
| Ember.js | 0.9.x | [active-model-adapter](https://github.com/ember-data/active-model-adapter)
|
||||
| Ember.js | 0.10.x + | [docs/integrations/ember-and-json-api.md](integrations/ember-and-json-api.md)
|
||||
| Grape | 0.10.x + | [#1258](https://github.com/rails-api/active_model_serializers/issues/1258) |
|
||||
| Grape | 0.10.x + | [docs/integrations/grape.md](integrations/grape.md) |
|
||||
| Grape | 0.9.x | https://github.com/jrhe/grape-active_model_serializers/ |
|
||||
| Sinatra | 0.9.x | https://github.com/SauloSilva/sinatra-active-model-serializers/
|
||||
|
||||
|
||||
19
docs/integrations/grape.md
Normal file
19
docs/integrations/grape.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Integration with Grape
|
||||
|
||||
[Grape](https://github.com/ruby-grape/grape) is an opinionated micro-framework for creating REST-like APIs in ruby.
|
||||
|
||||
ActiveModelSerializers currently supports Grape >= 0.13, < 1.0
|
||||
|
||||
To add [Grape](https://github.com/ruby-grape/grape) support, enable the formatter and helper functions by including `Grape::ActiveModelSerializers` in your base endpoint. For example:
|
||||
|
||||
```ruby
|
||||
module Example
|
||||
class Dummy < Grape::API
|
||||
require 'grape/active_model_serializers'
|
||||
include Grape::ActiveModelSerializers
|
||||
mount Example::V1::Base
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
Aside from this, [configuration](../general/configuration_options.md) of ActiveModelSerializers is exactly the same.
|
||||
Reference in New Issue
Block a user