0

I have the following line of code in my controller:

render json: {token: user.token}, status: 200

It used to respond as below: (root node is disabled by default)

{'token': 'ace814a7dd50acda5a76ff7e4c9f7252'}

Now I get the result as an array and that doesn't work for me.

[["token", "ace814a7dd50acda5a76ff7e4c9f7252"]]

How can I configure my Rails application to get my previous behavior back?

turhanco
  • 941
  • 10
  • 19
  • 1
    what version of AMS? – Anthony Nov 08 '14 at 15:09
  • gem 'active_model_serializers', github: 'rails-api/active_model_serializers', branch: '0-9-stable' This is the from my Gemfile – turhanco Nov 08 '14 at 15:22
  • 1
    revert back to `0.8`, `0.9` is a mess. – Anthony Nov 08 '14 at 15:22
  • Changing to ```gem 'active_model_serializers', github: 'rails-api/active_model_serializers', branch: 'master'``` fixed my issue. I couldn't think to change the AMS version. Thanks for your help. – turhanco Nov 08 '14 at 15:27
  • Do you want me to recap this in an answer? – Anthony Nov 08 '14 at 15:46
  • Damn it! 0-8-stable and master causes much more problems. 0-9-stable just better except hash to array problem. I am not sure to recap that in answer. AMS is totally mess. – turhanco Nov 08 '14 at 16:13

0 Answers0