app/controllers/v1/base_controller.rb
# Return nothing but JSON to avoid having to debug XML responses
Return nothing but JSON to avoid having to debug XML responses
Return nothing but JSON to avoid having to debug XML responses
def ensure_json
			if ((request.headers["HTTP_ACCEPT"].nil? && params[:format].nil?) ||
				(request.headers["HTTP_ACCEPT"].include?("*/*") && params[:format].nil?) ||
				(params[:format].downcase.eql?("json")) ||
				(request.headers["HTTP_ACCEPT"].include?("application/json")))
				@content_type = 'application/json; charset=utf-8'
			else
				render :nothing => true, :status => 406	and return
			end  			  			
		end
def ensure_json if ( ( request . headers [ "HTTP_ACCEPT" ] . nil? && params [ :format ] . nil? ) || ( request . headers [ "HTTP_ACCEPT" ] . include? ( "*/*" ) && params [ :format ] . nil? ) || ( params [ :format ] . downcase . eql? ( "json" ) ) || ( request . headers [ "HTTP_ACCEPT" ] . include? ( "application/json" ) ) ) @content_type = 'application/json; charset=utf-8' else render :nothing => true , :status => 406 and return end end
Return nothing but JSON to avoid having to debug XML responses
Return nothing but JSON to avoid having to debug XML responses
# TODO: fix this since it does not work perfectly