[PATCH/foreman 1/1] Feature #1524 Add more attributes to JSON index

Signed-off-by: Corey Osman <corey@logicminds.biz>

··· --- app/controllers/hosts_controller.rb | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/app/controllers/hosts_controller.rb b/app/controllers/hosts_controller.rb
index 55d388b…3261cf4 100644
— a/app/controllers/hosts_controller.rb
+++ b/app/controllers/hosts_controller.rb
@@ -39,7 +39,9 @@ class HostsController < ApplicationController
# rendering index page for non index page requests (out of sync hosts etc)
render :index if title and @title = title
end

  •  format.json { render :json => search.all(:select => "hosts.name", :include => included_associations).map(&:name) }
    
  •  # should you ever need more attributes just add to the :only array or specify :methods, :include, :except to the options hash
    
  •  format.json { render :json => Host.all.to_json({:only => ["name", "id", "hostgroup_id", "operatingsystem_id"], :include => included_associations})}
    
  •  format.yaml do
       render :text => if params["rundeck"]
         result = {}
    


1.7.1