Class: Sdb::SuppliersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/sdb/suppliers_controller.rb

Overview

rubocop:todo Style/Documentation

Instance Method Summary collapse

Instance Method Details

#createObject

Create a supplier


14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/sdb/suppliers_controller.rb', line 14

def create
  @supplier = Supplier.new(params[:supplier])

  respond_to do |format|
    if @supplier.save
      flash[:notice] = 'Supplier was successfully created.'
      format.html { redirect_to('/sdb/') }
    else
      format.html { render action: 'new' }
    end
  end
end

#editObject


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

def edit
  @supplier = Supplier.find(params[:id])
end

#indexObject

Show all suppliers


4
5
6
# File 'app/controllers/sdb/suppliers_controller.rb', line 4

def index
  @suppliers = Supplier.all
end

#newObject

Create a supplier


9
10
11
# File 'app/controllers/sdb/suppliers_controller.rb', line 9

def new
  @supplier = Supplier.new
end

#sample_manifestsObject


50
51
52
53
# File 'app/controllers/sdb/suppliers_controller.rb', line 50

def sample_manifests
  @supplier = Supplier.find(params[:id])
  @sample_manifests = @supplier.sample_manifests.paginate(page: params[:page])
end

#showObject

Show a supplier


46
47
48
# File 'app/controllers/sdb/suppliers_controller.rb', line 46

def show
  @supplier = Supplier.find(params[:id])
end

#studiesObject


55
56
57
58
# File 'app/controllers/sdb/suppliers_controller.rb', line 55

def studies
  @supplier = Supplier.find(params[:id])
  @studies = @supplier.studies.paginate(page: params[:page])
end

#updateObject

Update a supplier


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

def update
  @supplier = Supplier.find(params[:id])

  respond_to do |format|
    if @supplier.update(params[:supplier])
      flash[:notice] = 'Supplier was successfully updated'
      format.html { redirect_to(@supplier) }
    else
      format.html { render action: 'new' }
    end
  end
end