Class: PolicyManager::TermsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#admin_user, #allow_admins, #current_user, #doc, #set_language, #user_authenticated?

Instance Method Details

#createObject

POST /terms



22
23
24
25
26
27
28
29
30
# File 'app/controllers/policy_manager/terms_controller.rb', line 22

def create
  @term = Term.new(term_params)

  if @term.save
    redirect_to category_term_path(@term.rule.name, @term), notice: I18n.t("terms_app.terms.new.created")
  else
    render :new
  end
end

#destroyObject

DELETE /terms/1



42
43
44
45
# File 'app/controllers/policy_manager/terms_controller.rb', line 42

def destroy
  @term.destroy
  redirect_to category_terms_path(@term.rule.name), notice: I18n.t("terms_app.terms.new.destroyed")
end

#editObject

GET /terms/1/edit



18
19
# File 'app/controllers/policy_manager/terms_controller.rb', line 18

def edit
end

#newObject

GET /terms/new



13
14
15
# File 'app/controllers/policy_manager/terms_controller.rb', line 13

def new
  @term = Term.new
end

#showObject

GET /terms/1



9
10
# File 'app/controllers/policy_manager/terms_controller.rb', line 9

def show
end

#updateObject

PATCH/PUT /terms/1



33
34
35
36
37
38
39
# File 'app/controllers/policy_manager/terms_controller.rb', line 33

def update
  if @term.update(term_params)
    redirect_to category_term_path(@term.rule.name, @term), notice: I18n.t("terms_app.terms.new.updated")
  else
    render :edit
  end
end