By default not all serializer options are considered (for instance
the :root option, or the :each_serializer option). This potentially
results in an incomplete configuration of the serializers used.
Added 2 specs to test this when used as a single endpoint and when
used within a namespace. At the moment it is fixed by plucking
the correct settings in the .build_options_from_endpoint,
but I could imagine that this is not exactly the right spot.
* 'master' of github.com:jrhe/grape-active_model_serializers:
fix: when resource is empty, keep json resource root
support active model serializer 0.9.x
[Issue #13] Add render syntactic sugar
As in issue #13 an example solution provided by @jrhe an implementation
of said feature has been created.
As per the discussion in the thread this is only a helper to be able to
reach the available options provided in the active_model_serializer gem.
usage is as follows:
```ruby
get '/some_path' do
collection = Collection.all
render collection, { meta: { current_page: 5 }, meta_key:
:pagination_info }
end
```
The return value would be:
`{ pagination_info: { current_page: 5 }, collection: [item, item] }`
If given without a `meta_key` it would return as:
`{ meta: { current_page: 5 }, collection: [item, item] }`
Any feedback appreciated.
@zph, @olleolleolle and @bjoska
Adding methods into the Grape::Endpoint class that
ActiveModel::Serializers are relying on from ActionController as well as
a few convenience methods for Route and Namespace options. I believe we
can expand on some of the empty methods here to allow for higher (api)
level option setting and defaults. This is a first step in that
direction.
There are some dependencies that are not required for this gem (eg.
tilt) that I'm removing. In addition some of the dependencies were only
necessary for development/test so I'm moving all of that into the gempsec and
making that clear there.