Class: Sdb::SuppliersController

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

Instance Method Summary collapse

Instance Method Details

#createObject

Create a supplier


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

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


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

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

#indexObject

Show all suppliers


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

def index
  @suppliers = Supplier.all
end

#newObject

Create a supplier


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

def new
  @supplier = Supplier.new
end

#sample_manifestsObject


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

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

#showObject

Show a supplier


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

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

#studiesObject


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

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

#updateObject

Update a supplier


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

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