Class: Iron::ContentTypesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
# File 'app/controllers/iron/content_types_controller.rb', line 21

def create
  @content_type = ContentType.new(content_type_params)

  if @content_type.save
    redirect_to @content_type, notice: t("iron.content_types.notifications.created")
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



39
40
41
42
# File 'app/controllers/iron/content_types_controller.rb', line 39

def destroy
  @content_type.destroy!
  redirect_to content_types_path, notice: t("iron.content_types.notifications.destroyed"), status: :see_other
end

#editObject



18
19
# File 'app/controllers/iron/content_types_controller.rb', line 18

def edit
end

#indexObject



6
7
8
9
# File 'app/controllers/iron/content_types_controller.rb', line 6

def index
  @content_types = ContentType.order(:name)
  @grouped_content_types = @content_types.group_by(&:humanized_type)
end

#newObject



14
15
16
# File 'app/controllers/iron/content_types_controller.rb', line 14

def new
  @content_type = ContentType.new
end

#showObject



11
12
# File 'app/controllers/iron/content_types_controller.rb', line 11

def show
end

#updateObject



31
32
33
34
35
36
37
# File 'app/controllers/iron/content_types_controller.rb', line 31

def update
  if @content_type.update(content_type_params)
    redirect_to @content_type, notice: t("iron.content_types.notifications.updated"), status: :see_other
  else
    render :edit, status: :unprocessable_entity
  end
end