0

Rails 4.1.4 Ruby 2.2.0

What I want:

{
playlists: [
    {
        id: 2,
        name: "First MySQL Playlist",
    }
],
meta: {
    current_page: 1
}

}

What I'm getting:

[
{
    id: 2,
    name: "First MySQL Playlist",
}

]

I've done this many many many times before and have no idea why it's showing up like this. I've compared environments to previous projects, which work exactly how I want, and can't find any discrepancies. I'm hoping someone can spot something I'm missing.

gem 'protected_attributes'

gem 'active_model_serializers'

gem 'mysql2' gem 'kaminari'

Controller:

def index

    @playlists = Playlist.page(0).per(100)

    respond_with @playlists,
    root: :playlists,
    meta: {
      current_page: @playlists.current_page,
    }

    end
AthleteInAction
  • 435
  • 4
  • 14

1 Answers1

0

This did it:

gem 'active_model_serializers', '~> 0.8.3'
gem 'mysql2','~> 0.3.18'
AthleteInAction
  • 435
  • 4
  • 14