It appears a table in sql server is placing nil
in the select statement. I have no idea how to fix this, and if I switch to any other table, I can easily acquir
While I still believe this is a bug in active record, I was able to get around it with the https://github.com/rails-api/active_model_serializers gem. This gem overrides to_json eliminated the need for the bug code in active record to be called.
anyone else have a better answer?
Updated Controller:
class V1::DealsController < ApplicationController
def by_mall_id
deals = Deal.where(mallid: params[:id]).first
render json: deals, serializer: V1::DealSerializer
end
end
My new DealSerializer:
class V1::DealSerializer < ActiveModel::Serializer
attributes :MALLID
def MALLID
object.mallid
end
end