Class: PostCategoriesController

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

Instance Method Summary collapse

Instance Method Details

#createObject

post /post_categories



11
12
13
14
15
16
17
18
# File 'app/controllers/post_categories_controller.rb', line 11

def create
  @entity = PostCategory.new(creation_parameters)
  if @entity.save
    form_processed_ok((id: @entity.id))
  else
    form_processed_with_error(:new)
  end
end

#destroyObject

delete /post_categories/:id



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

def destroy
  if @entity.destroy
    flash[:notice] = t('post_categories.destroy.success')
  end
  redirect_to(post_categories_admin_post_type_path(id: @entity.post_type_id))
end

#editObject

get /post_categories/:id/edit



21
22
# File 'app/controllers/post_categories_controller.rb', line 21

def edit
end

#newObject

get /post_categories/new



6
7
8
# File 'app/controllers/post_categories_controller.rb', line 6

def new
  @entity = PostCategory.new
end

#updateObject

patch /post_categories/:id



25
26
27
28
29
30
31
# File 'app/controllers/post_categories_controller.rb', line 25

def update
  if @entity.update entity_parameters
    form_processed_ok((id: @entity.id))
  else
    form_processed_with_error(:edit)
  end
end