Class: ContributionsController
- Inherits:
-
ArtfullyOseController
- Object
- ActionController::Base
- ArtfullyOseController
- ContributionsController
- Defined in:
- app/controllers/contributions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
45 46 47 48 49 |
# File 'app/controllers/contributions_controller.rb', line 45 def create @contribution = create_contribution @contribution.save redirect_to person_path params[:contribution][:person_id] end |
#destroy ⇒ Object
37 38 39 40 41 42 43 |
# File 'app/controllers/contributions_controller.rb', line 37 def destroy @order = Order.find(params[:id]) :edit, @order @order.destroy flash[:notice] = "Your order has been deleted" redirect_to contributions_path end |
#edit ⇒ Object
20 21 22 23 24 25 |
# File 'app/controllers/contributions_controller.rb', line 20 def edit @order = Order.find(params[:id]) :edit, @order @contribution = Contribution.for(@order) render :layout => false end |
#index ⇒ Object
2 3 4 5 6 7 8 |
# File 'app/controllers/contributions_controller.rb', line 2 def index :manage, Order @search = DonationSearch.new(params[:start], params[:stop], current_user.current_organization) do |results| results.sort{|a,b| b.created_at <=> a.created_at }.paginate(:page => params[:page], :per_page => 25) end end |
#new ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/contributions_controller.rb', line 10 def new @contribution = create_contribution if @contribution.has_contributor? render :new else @contributors = contributors render :find_person end end |
#update ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/contributions_controller.rb', line 27 def update @order = Order.find(params[:order_id]) :edit, @order @contribution = Contribution.for(@order) new_contribution = Contribution.new(params[:contribution]) @contribution.update(new_contribution) flash[:notice] = "Your order has been edited" redirect_to order_path(@order) end |