Actions
Feature #865
closedcreate method for updating multiple hosts via name instead of id
Description
I need a method to update multiple hosts via a name. I altered some code but I don't understand how the find function works with the params.
Need some clarification on whats going on with the following line of code.
@hosts = Host.find(params[:host_names], :order => "hostgroup_id ASC")
Here is what I put together as a future patch for this feature.
def find_multiple if not params[:host_ids].blank? @hosts = Host.find(params[:host_ids], :order => "hostgroup_id ASC") elsif not params[:host_names].blank? @hosts = Host.find(params[:host_names], :order => "hostgroup_id ASC") else error 'No Hosts selected' redirect_to(hosts_path) and return false end rescue => e error "Something went wrong while selecting hosts - #{e}" redirect_to hosts_path end
Actions