Project

General

Profile

« Previous | Next » 

Revision ee878ae8

Added by Ohad Levy over 12 years ago

  • ID ee878ae8d644d902f3a9b60a2eb34a3c1a31eea1

fixes #1161 - adds graph per facts

Signed-off-by: Amos Benari <>

View differences:

app/controllers/facts_controller.rb
class FactsController < ApplicationController
before_filter :valid_request?
def index
# we currently only support JSON in this controller
return not_found unless api_request?
render :json => FactName.no_timestamp_fact
end
def show
@fact = FactName.find(params[:id])
begin
data = {:name => @fact.name, :values => FactValue.count_each(@fact.name).to_a }
rescue
data = @fact
end
render :json => data
end
private
# we currently only support JSON in this controller
def valid_request?
return not_found unless api_request?
end
end

Also available in: Unified diff