Class: FundosController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/fundos_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /banners POST /banners.xml



26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/fundos_controller.rb', line 26

def create
  @fundo = Fundo.new(params[:fundo])

  respond_to do |format|
    if @fundo.save
      flash[:notice] = 'Fundo adicionado com sucesso.'
      format.html { redirect_to(fundos_url)}
    else
      format.html { render :action => "new" }
    end
  end
end

#destroyObject



52
53
54
55
56
57
58
59
# File 'app/controllers/fundos_controller.rb', line 52

def destroy
  @fundo = Fundo.find(params[:id])
  @fundo.destroy

  respond_to do |format|
    format.html { redirect_to(fundos_url) }
  end
end

#editObject

GET /banners/1/edit



20
21
22
# File 'app/controllers/fundos_controller.rb', line 20

def edit
  @fundo = Fundo.find(params[:id])
end

#indexObject



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

def index
  @fundos = Fundo.all
end

#newObject



14
15
16
17
# File 'app/controllers/fundos_controller.rb', line 14

def new
  @fundo = Fundo.new

end

#updateObject



39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/fundos_controller.rb', line 39

def update
  @fundo = Fundo.find(params[:id])

  respond_to do |format|
    if @fundo.update_attributes(params[:fundo])
      flash[:notice] = 'Fundo adicionado com sucesso.'
      format.html { redirect_to(fundos_url)}
    else
      format.html { render :action => "edit" }
    end
  end
end