Class: Sdb::SuppliersController
- Inherits:
-
BaseController
- Object
- BaseController
- Sdb::SuppliersController
- Defined in:
- app/controllers/sdb/suppliers_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
Create a supplier.
- #edit ⇒ Object
-
#index ⇒ Object
Show all suppliers.
-
#new ⇒ Object
Create a supplier.
- #sample_manifests ⇒ Object
-
#show ⇒ Object
Show a supplier.
- #studies ⇒ Object
-
#update ⇒ Object
Update a supplier.
Instance Method Details
#create ⇒ Object
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 |
#edit ⇒ Object
18 19 20 |
# File 'app/controllers/sdb/suppliers_controller.rb', line 18 def edit @supplier = Supplier.find(params[:id]) end |
#index ⇒ Object
Show all suppliers
4 5 6 |
# File 'app/controllers/sdb/suppliers_controller.rb', line 4 def index @suppliers = Supplier.all end |
#new ⇒ Object
Create a supplier
14 15 16 |
# File 'app/controllers/sdb/suppliers_controller.rb', line 14 def new @supplier = Supplier.new end |
#sample_manifests ⇒ Object
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 |
#show ⇒ Object
Show a supplier
9 10 11 |
# File 'app/controllers/sdb/suppliers_controller.rb', line 9 def show @supplier = Supplier.find(params[:id]) end |
#studies ⇒ Object
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 |
#update ⇒ Object
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 |