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



23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/sdb/suppliers_controller.rb', line 23

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



18
19
20
# File 'app/controllers/sdb/suppliers_controller.rb', line 18

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



14
15
16
# File 'app/controllers/sdb/suppliers_controller.rb', line 14

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



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

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



37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/sdb/suppliers_controller.rb', line 37

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