To override your root nodes for ActiveModel serializers without a global config use the following. This makes a consistent API for clients regardless of model but still leaves your code flexible.

# Controller
render json: @liked, root: 'data'

# Returns a collection like so.
{
  "data" [{}, {}, {}]
}

Leave a Reply

Screen Shot 2013-12-08 at 9.49.35 PM

I have helped a dozen companies build and optimize their engineering teams to deliver great products.

Let’s work together and I can align your business needs with your technology initiatives.