Class: ForemanResourceQuota::ResourceQuotasController

Inherits:
ApplicationController show all
Includes:
Foreman::Controller::AutoCompleteSearch, Foreman::Controller::Parameters::ResourceQuota
Defined in:
app/controllers/foreman_resource_quota/resource_quotas_controller.rb

Instance Method Summary collapse

Methods included from Foreman::Controller::Parameters::ResourceQuota

#resource_quota_params

Methods inherited from ApplicationController

#resource_class

Instance Method Details

#createObject



22
23
24
25
26
27
28
29
# File 'app/controllers/foreman_resource_quota/resource_quotas_controller.rb', line 22

def create
  @resource_quota = ResourceQuota.new(resource_quota_params)
  if @resource_quota.save
    process_success
  else
    process_error
  end
end

#destroyObject



42
43
44
45
46
47
48
# File 'app/controllers/foreman_resource_quota/resource_quotas_controller.rb', line 42

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

#editObject



31
32
# File 'app/controllers/foreman_resource_quota/resource_quotas_controller.rb', line 31

def edit
end

#indexObject



10
11
12
13
14
15
16
# File 'app/controllers/foreman_resource_quota/resource_quotas_controller.rb', line 10

def index
  @resource_quotas = resource_base.search_for(params[:search], order: params[:order]).paginate(page: params[:page],
    per_page: params[:per_page])
  # TODO: Check necessitiy/purpose of authorizer
  # AuthorizerHelper#authorizer uses controller_name as variable name, but it fails with namespaces
  # @authorizer = Authorizer.new(User.current, collection: @resource_quotas)
end

#newObject



18
19
20
# File 'app/controllers/foreman_resource_quota/resource_quotas_controller.rb', line 18

def new
  @resource_quota = ResourceQuota.new
end

#updateObject



34
35
36
37
38
39
40
# File 'app/controllers/foreman_resource_quota/resource_quotas_controller.rb', line 34

def update
  if @resource_quota.update(resource_quota_params)
    process_success
  else
    process_error
  end
end