Class: FactsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/facts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#api_request?, #welcome

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#indexObject


4
5
6
# File 'app/controllers/facts_controller.rb', line 4

def index
  render :json => FactName.no_timestamp_fact
end

#showObject


8
9
10
11
12
13
14
15
16
# File 'app/controllers/facts_controller.rb', line 8

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