Class: PostTypesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#dashboard, #keyboard_tools, #upload

Instance Method Details

#createObject



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

def create
  @type = PostType.new post_type_params
  if @type.save
    clear_cache!
    redirect_to post_types_path
  else
    render :new
  end
end

#editObject



33
# File 'app/controllers/post_types_controller.rb', line 33

def edit; end

#indexObject



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

def index
  @types = PostType.all
end

#listObject



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

def list
  @types = PostType.all
  respond_to do |format|
    format.json do
      render json: @types
    end
  end
end

#newObject



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

def new
  @type = PostType.new
end

#updateObject



35
36
37
38
39
40
41
42
# File 'app/controllers/post_types_controller.rb', line 35

def update
  if @type.update post_type_params
    clear_cache!
    redirect_to post_types_path
  else
    render :edit
  end
end