Class: BarcodePrintersController

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

Overview

rubocop:todo Style/Documentation

Constant Summary

Constants included from FlashTruncation

FlashTruncation::STRING_OVERHEAD

Instance Method Summary collapse

Methods inherited from ApplicationController

#block_api_access, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!

Methods included from FlashTruncation

#max_flash_size, #truncate_flash, #truncate_flash_array

Instance Method Details

#createObject


31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/barcode_printers_controller.rb', line 31

def create
  @barcode_printer = BarcodePrinter.new(params[:barcode_printer])
  @barcode_printer.barcode_printer_type = BarcodePrinterType.find(params[:barcode_printer_type_id])

  respond_to do |format|
    if @barcode_printer.save
      flash[:notice] = 'Barcode Printer was successfully created.'
      format.html { redirect_to(barcode_printers_url) }
    else
      format.html { render action: 'new' }
    end
  end
end

#destroyObject


59
60
61
62
63
64
# File 'app/controllers/barcode_printers_controller.rb', line 59

def destroy
  @barcode_printer = BarcodePrinter.find(params[:id])
  @barcode_printer.destroy

  respond_to { |format| format.html { redirect_to(barcode_printers_url) } }
end

#editObject


27
28
29
# File 'app/controllers/barcode_printers_controller.rb', line 27

def edit
  @barcode_printer = BarcodePrinter.find(params[:id])
end

#indexObject


9
10
11
12
13
# File 'app/controllers/barcode_printers_controller.rb', line 9

def index
  @barcode_printers = BarcodePrinter.all

  respond_to { |format| format.html }
end

#newObject


21
22
23
24
25
# File 'app/controllers/barcode_printers_controller.rb', line 21

def new
  @barcode_printer = BarcodePrinter.new

  respond_to { |format| format.html }
end

#showObject


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

def show
  @barcode_printer = BarcodePrinter.find(params[:id])

  respond_to { |format| format.html }
end

#updateObject

rubocop:todo Metrics/AbcSize


45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/controllers/barcode_printers_controller.rb', line 45

def update # rubocop:todo Metrics/AbcSize
  @barcode_printer = BarcodePrinter.find(params[:id])
  @barcode_printer.barcode_printer_type = BarcodePrinterType.find(params[:barcode_printer_type_id])

  respond_to do |format|
    if @barcode_printer.update(params[:barcode_printer])
      flash[:notice] = 'Barcode Printer was successfully updated.'
      format.html { redirect_to(barcode_printers_url) }
    else
      format.html { render action: 'edit' }
    end
  end
end