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