Skip to content

New 0.9 gem does not work out of the box with rails-api #600

Closed
@denkristoffer

Description

@denkristoffer

I'm not sure whether this issue should be opened here or on the rails-api repository so let me know if this is the wrong place.

Anyway, active_model_serializers does not work out of the box with a new rails-api project, as the JSON responses aren't being overridden. I found this Stack Overflow question, which resulted in one solution: making ApplicationController inherit from ActionController::Base instead of ActionController::API. With this I found out that ApplicationController needs ActionController::Serialization for AMS to work.

For those of you that are experiencing the issue, that means that you can just add the following to ApplicationController to work around the issue for now:

include ActionController::Serialization

If this behaviour is intended, shouldn't it be mentioned in the README?

I'm on Rails 4.1.5, rails-api 0.2.1 and active_model_serializers 0.9.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions