Class: IshManager::InvoicesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::InvoicesController
- Defined in:
- app/controllers/ish_manager/invoices_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/ish_manager/invoices_controller.rb', line 15 def create @invoice = Ish::Invoice.new params[:invoice].permit! :create, @invoice if @invoice.save flash[:notice] = "created invoice" else flash[:alert] = "Cannot create invoice: #{@invoice.errors.}" end redirect_to :action => 'index' end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/ish_manager/invoices_controller.rb', line 6 def index :index, Ish::Invoice @invoices = Ish::Invoice.all.includes( :payments ) end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/ish_manager/invoices_controller.rb', line 11 def new :new, @invoice end |
#update ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/ish_manager/invoices_controller.rb', line 26 def update @invoice = Ish::Invoice.find params[:id] :update, @invoice if @invoice.update_attributes params[:invoice].permit! flash[:notice] = 'Success' redirect_to :action => 'index' else flash[:alert] = "Cannot update invoice: #{@invoice.errors.}" end redirect_to :action => 'index' end |