0

So I'm trying to build rails API app with rails 4 and ruby 2.0.0 ActiveModelSerializer gem (0.8.1) and Doorkeeper gem(actually it's fork (https://github.com/simonbnrd/doorkeeper) for using this game with mongoid 4, but I don't think that's the case). When I start my app and use ActiveModel::ArraySerializer to create new object and then try to render it as json - everything works fine. But if I make the same sequence of actions AFTER I call method (from Doorkeeper gem) Doorkeeper::TokensController.create render to json app suddenly returns string. Trying to investigate this issue I couldn't have find source code location for to_json method.

def index
 @users = User.all
 a = ActiveModel::ArraySerializer.new(@users)
 raise a.class.method(:to_json).source_location.inspect
 render json: @users
end

This returns

gems/activesupport-4.0.1/lib/active_support/core_ext/object/to_json.rb

before Doorkeeper call and

nil

after

roflomglol
  • 27
  • 4
  • Hey, which version of AMS are you using? that could be a problem in there, or on Mongoid side too.. fell free to ping me at irc arthurnn@freenode or on the #mongoid@freenode channel – Arthur Neves Nov 19 '13 at 21:02
  • Hey, yeah, forgot to mention it: AMS version is 0.8.1, last one afaik – roflomglol Nov 20 '13 at 08:38

0 Answers0