Class: Legacy::PostCategoriesController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/legacy/post_categories_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

post /post_categories



7
8
9
10
11
12
13
14
15
# File 'app/controllers/legacy/post_categories_controller.rb', line 7

def create
  @entity = PostCategory.new creation_parameters
  if @entity.save
    cache_relatives
    redirect_to (id: @entity.id)
  else
    render :new, status: :bad_request
  end
end

#destroyObject

delete /post_categories/:id



32
33
34
35
36
37
# File 'app/controllers/legacy/post_categories_controller.rb', line 32

def destroy
  if @entity.update deleted: true
    flash[:notice] = t('post_categories.destroy.success')
  end
  redirect_to admin_post_categories_path
end

#editObject

get /post_categories/:id/edit



18
19
# File 'app/controllers/legacy/post_categories_controller.rb', line 18

def edit
end

#updateObject

patch /post_categories/:id



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

def update
  if @entity.update entity_parameters
    cache_relatives
    redirect_to (id: @entity.id), notice: t('post_categories.update.success')
  else
    render :edit, status: :bad_request
  end
end