I have a controller that looks like this:
class DataController < ApplicationController::Base
def index
@data = Data.all
render json: @data, each_seralizer: DataSerializer
end
end
And I'm using ActiveModel::Serializer to serialize the data. The problem is that when I navigate to the url in my browser, it responds by sending a file data.json instead of just rendering the json. If I do render body: DataSerializer.new(@some_record).to_json
it renders the json in the browser as expected.
What am I missing?
Thank's in advance.
EDIT: I realized this only happens for me in IE, not in Chrome for example. So perhaps a browser setting?