Class: Iron::ContentTypesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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



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

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

#editObject



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

def edit
end

#indexObject



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

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

#newObject



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

def new
  @content_type = ContentType.new
end

#showObject



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

def show
end

#updateObject



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

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