Class: SponsoredProjectAllocationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SponsoredProjectAllocationsController
- Defined in:
- app/controllers/sponsored_project_allocations_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#archive ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/controllers/sponsored_project_allocations_controller.rb', line 54 def archive :archive, SponsoredProjectAllocation @allocation = SponsoredProjectAllocation.find(params[:id]) if @allocation.update_attributes({:is_archived => true}) flash[:notice] = 'Allocation was successfully archived.' redirect_to(sponsored_project_allocations_path) else flash[:notice] = 'Allocation could not be archived.' redirect_to(sponsored_project_allocations_path) end end |
#create ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/sponsored_project_allocations_controller.rb', line 26 def create :create, SponsoredProjectAllocation @allocation = SponsoredProjectAllocation.new(params[:sponsored_project_allocation]) @users = User.staff @projects = SponsoredProject.current if @allocation.save flash[:notice] = 'Allocation was successfully created.' redirect_to(sponsored_project_allocations_path) else render "new" end end |
#edit ⇒ Object
19 20 21 22 23 24 |
# File 'app/controllers/sponsored_project_allocations_controller.rb', line 19 def edit :update, SponsoredProjectAllocation @allocation = SponsoredProjectAllocation.find(params[:id]) @users = User.staff @projects = SponsoredProject.current end |
#index ⇒ Object
7 8 9 10 |
# File 'app/controllers/sponsored_project_allocations_controller.rb', line 7 def index :read, SponsoredProjectAllocation @allocations = SponsoredProjectAllocation.current end |
#new ⇒ Object
12 13 14 15 16 17 |
# File 'app/controllers/sponsored_project_allocations_controller.rb', line 12 def new :create, SponsoredProjectAllocation @allocation = SponsoredProjectAllocation.new @users = User.staff @projects = SponsoredProject.current end |
#update ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/sponsored_project_allocations_controller.rb', line 40 def update :update, SponsoredProjectAllocation @allocation = SponsoredProjectAllocation.find(params[:id]) @users = User.staff @projects = SponsoredProject.current if @allocation.update_attributes(params[:sponsored_project_allocation]) flash[:notice] = 'Allocation was successfully updated.' redirect_to(sponsored_project_allocations_path) else render "edit" end end |