Class: Bookkeeper::OutgoingsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/bookkeeper/outgoings_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
# File 'app/controllers/bookkeeper/outgoings_controller.rb', line 13

def create
  @outgoing = Outgoing.new(params[:outgoing])

  if @outgoing.save
    redirect_to balance_index_path, notice: I18n.t('.bookkeeper.controllers.outgoings.created')
  else
    render action: "new"
  end
end

#destroyObject



33
34
35
36
37
38
39
# File 'app/controllers/bookkeeper/outgoings_controller.rb', line 33

def destroy
  @outgoing = Outgoing.find(params[:id])
  @outgoing.destroy
  flash[:notice] = I18n.t('.bookkeeper.controllers.outgoings.destroyed')

  redirect_to balance_index_path
end

#editObject



9
10
11
# File 'app/controllers/bookkeeper/outgoings_controller.rb', line 9

def edit
  @outgoing = Outgoing.find(params[:id])
end

#newObject



5
6
7
# File 'app/controllers/bookkeeper/outgoings_controller.rb', line 5

def new
  @outgoing = Outgoing.new
end

#updateObject



23
24
25
26
27
28
29
30
31
# File 'app/controllers/bookkeeper/outgoings_controller.rb', line 23

def update
  @outgoing = Outgoing.find(params[:id])

  if @outgoing.update_attributes(params[:outgoing])
    redirect_to balance_index_path, notice: I18n.t('.bookkeeper.controllers.outgoings.updated')
  else
    render action: "edit"
  end
end