Class: HelpCenter::SupportCategoriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/help_center/support_categories_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#is_moderator?, #is_moderator_or_owner?, #page_number, #require_mod_or_author_for_post!, #require_mod_or_author_for_thread!

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/help_center/support_categories_controller.rb', line 17

def create
  @category = SupportCategory.new(support_category_params)

  if @category.save
    redirect_to help_center.support_threads_path
  else
    render action: :new
  end
end

#destroyObject



38
39
40
41
# File 'app/controllers/help_center/support_categories_controller.rb', line 38

def destroy
  @category.destroy
  redirect_to help_center.support_threads_path, notice: I18n.t('successfully_deleted')
end

#editObject



27
28
# File 'app/controllers/help_center/support_categories_controller.rb', line 27

def edit
end

#indexObject



7
8
# File 'app/controllers/help_center/support_categories_controller.rb', line 7

def index
end

#newObject



10
11
12
# File 'app/controllers/help_center/support_categories_controller.rb', line 10

def new
  @category = SupportCategory.new
end

#showObject



14
15
# File 'app/controllers/help_center/support_categories_controller.rb', line 14

def show
end

#updateObject



30
31
32
33
34
35
36
# File 'app/controllers/help_center/support_categories_controller.rb', line 30

def update
  if @category.update(support_category_params)
    redirect_to help_center.support_category_path(@category), notice: I18n.t('your_changes_were_saved')
  else
    render action: :edit
  end
end