app/controllers/invoices_controller.rb
#
# Creates new invoice by AJAX.
#
Creates new invoice by AJAX.
Creates new invoice by AJAX .
def create_new
    @invoice = Invoice.new(params[:invoice])
    @invoice.user_id = @current_user.id
    @success = false
    if @invoice.save
      @success = true
    end
    @invoices = Invoice.find(:all, :conditions => ["client_id = ? AND is_issued=0", @invoice.client_id]) 
  end
def create_new @invoice = Invoice . new ( params [ :invoice ] ) @invoice . user_id = @current_user . id @success = false if @invoice . save @success = true end @invoices = Invoice . find ( :all , :conditions => [ "client_id = ? AND is_issued=0" , @invoice . client_id ] ) end
Creates new invoice by AJAX.
Creates new invoice by AJAX .