Class: DetailsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/details_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @detail = Detail.new(detail_params)
  if @detail.save
    redirect_to @detail, notice: t('details.create.notice')
  else
    render action: "new", warning: t('details.create.warning'), layout: 'admin'
  end
end

#destroyObject



39
40
41
42
43
44
45
46
# File 'app/controllers/details_controller.rb', line 39

def destroy
  @detail = Detail.find(params[:id])
  if @detail.destroy
    redirect_to users_path, notice: t('details.destroy.notice')
  else
    redirect_to users_path, warning: t('details.destroy.warning')
  end
end

#editObject



16
17
18
19
# File 'app/controllers/details_controller.rb', line 16

def edit
  @detail = Detail.find(params[:id])
  switch_to_admin_layout
end

#newObject



11
12
13
14
# File 'app/controllers/details_controller.rb', line 11

def new
  @detail = Detail.new
  switch_to_admin_layout
end

#showObject



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

def show
  @detail = Detail.find(params[:id])
  switch_to_admin_layout
end

#updateObject



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

def update
  @detail = Detail.find(params[:id])
  if @detail.update_attributes(detail_params)
    redirect_to @detail, notice: t('details.update.notice')
  else
    render action: "edit", warning: t('details.update.warning'), layout: 'admin'
  end
end