Whats the easiest way of adding custom json output when you render json? I've seen people override as_json or to_json but they usually exclude attributes or include associations. Is there a way of including plain text?
in my view:
def show_json
show_id = URI.decode(params[:id])
show_id = show_id.gsub(/\s*$/,'')
logger.debug "\nshow json: #{show_id}\n"
@qtls = Qtl.find_by_sql("select * from qtls where qtl_name like '%#{show_id}%' or qtl_symbol in (select qtl_symbol from obs_traits where qtl_symbol like '%#{show_id}%' or trait_name like '%#{show_id}%');")
render :json => @qtls
end
this returns something like:
[{qtl: {...qtl attributes..}},{... more qtls }]
and I would like to add a a specific field for each qtl. Whats best way to do that?