Class: Pulitzer::PostTypesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pulitzer/post_types_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
# File 'app/controllers/pulitzer/post_types_controller.rb', line 13

def create
  @post_type = Pulitzer::PostType.create(post_type_params)
  Pulitzer::CreateSingletonPost.new(@post_type, post_params_name).call
  render partial: 'show_wrapper', locals: {post_type: @post_type}
end

#destroyObject



33
34
35
36
# File 'app/controllers/pulitzer/post_types_controller.rb', line 33

def destroy
  @post_type.destroy
  render nothing: true
end

#editObject



23
24
25
# File 'app/controllers/pulitzer/post_types_controller.rb', line 23

def edit
  render partial: 'form', locals: {post_type: @post_type}
end

#indexObject



4
5
6
# File 'app/controllers/pulitzer/post_types_controller.rb', line 4

def index
  @post_types = Pulitzer::PostType.all
end

#newObject



8
9
10
11
# File 'app/controllers/pulitzer/post_types_controller.rb', line 8

def new
  @post_type = Pulitzer::PostType.new
  render partial: 'new', locals: {post_type: @post_type}
end

#showObject



19
20
21
# File 'app/controllers/pulitzer/post_types_controller.rb', line 19

def show
  render partial: 'show', locals: {post_type: @post_type}
end

#updateObject



27
28
29
30
31
# File 'app/controllers/pulitzer/post_types_controller.rb', line 27

def update
  @post_type.update_attributes(post_type_params)
  Pulitzer::UpdateSingletonPost.new(@post_type, post_params_name).call
  render partial: 'show', locals: {post_type: @post_type}
end