Sha256: 5ef0afa9b17794de0d06dedff4a880580563b887bc14daa6955f2daeb2aadfd1

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require_dependency "adherent/application_controller"

module Adherent
  class PaymentsController < ApplicationController
    
    before_filter :find_member
    
    def index
      @payments = @member.payments
    end
  
    def new
      @payment = @member.payments.new(date:Date.today, amount:@member.unpaid_amount)
    end
    
    def create
      @payment=@member.payments.new(params[:payment])
      if @payment.save
        
        flash[:notice] = 'Le paiement a été enregistré' 
        redirect_to member_adhesions_path(@member)
      else
        flash[:alert] = 'Impossible d\'enregistrer ce paiement'
        render 'new'
      end
    end
  
    def edit
    end
  
    def show
    end
    
    # DELETE /payment/1
    # DELETE /coords/1.json
    def destroy
      @payment = @member.payments.find(params[:id])
      @payment.destroy
  
      respond_to do |format|
        format.html { redirect_to member_payments_url(@member) }
        
      end
    end
    
    
    protected
    
    
    
    def find_member
      @member = Member.find(params[:member_id])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
adherent-0.1.0 app/controllers/adherent/payments_controller.rb
adherent-0.0.9 app/controllers/adherent/payments_controller.rb
adherent-0.0.7 app/controllers/adherent/payments_controller.rb
adherent-0.0.6 app/controllers/adherent/payments_controller.rb
adherent-0.0.5 app/controllers/adherent/payments_controller.rb