Class: DiscoveryRulesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/discovery_rules_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
# File 'app/controllers/discovery_rules_controller.rb', line 16

def create
  @discovery_rule = DiscoveryRule.new(params[:discovery_rule])
  if @discovery_rule.save
    process_success
  else
    process_error
  end
end

#destroyObject



36
37
38
39
40
41
42
# File 'app/controllers/discovery_rules_controller.rb', line 36

def destroy
  if @discovery_rule.destroy
    process_success
  else
    process_error
  end
end

#disableObject



48
49
50
# File 'app/controllers/discovery_rules_controller.rb', line 48

def disable
  set_enabled false
end

#editObject



25
26
# File 'app/controllers/discovery_rules_controller.rb', line 25

def edit
end

#enableObject



44
45
46
# File 'app/controllers/discovery_rules_controller.rb', line 44

def enable
  set_enabled true
end

#indexObject



7
8
9
10
# File 'app/controllers/discovery_rules_controller.rb', line 7

def index
  base = resource_base.search_for(params[:search], :order => (params[:order] || 'priority ASC'))
  @discovery_rules = base.paginate(:page => params[:page]).includes(:hostgroup)
end

#newObject



12
13
14
# File 'app/controllers/discovery_rules_controller.rb', line 12

def new
  @discovery_rule = DiscoveryRule.new
end

#updateObject



28
29
30
31
32
33
34
# File 'app/controllers/discovery_rules_controller.rb', line 28

def update
  if @discovery_rule.update_attributes(params[:discovery_rule])
    process_success
  else
    process_error
  end
end