Class: Eboshi::PaymentsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/eboshi/payments_controller.rb

Instance Method Summary collapse

Methods included from ShallowRouteHelper

#assignment_path, #assignments_path, #convert_work_path, #edit_adjustment_path, #edit_invoice_path, #edit_work_path, #invoice_path, #invoices_path, #line_item_path, #merge_works_path, #new_adjustment_path, #new_assignment_path, #new_invoice_path, #new_payment_path, #payments_path, #work_path

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/eboshi/payments_controller.rb', line 10

def create
  @payment = @invoice.payments.build params[:payment]
  if @payment.save
    flash[:notice] = "Payment successfully created."
    redirect_to invoices_path(@invoice.client)
  else
    render :new
  end
end

#newObject



6
7
8
# File 'app/controllers/eboshi/payments_controller.rb', line 6

def new
  @payment = @invoice.payments.build(params[:payment] || { total: @invoice.balance })
end