Class: BannersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- BannersController
- Defined in:
- app/controllers/banners_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /banners POST /banners.xml.
- #crop ⇒ Object
-
#destroy ⇒ Object
DELETE /banners/1 DELETE /banners/1.xml.
-
#edit ⇒ Object
GET /banners/1/edit.
- #index ⇒ Object
-
#new ⇒ Object
GET /banners/new GET /banners/new.xml.
-
#show ⇒ Object
GET /banners/1 GET /banners/1.xml.
-
#update ⇒ Object
PUT /banners/1 PUT /banners/1.xml.
Instance Method Details
#create ⇒ Object
POST /banners POST /banners.xml
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/banners_controller.rb', line 48 def create @banner = Banner.new(params[:banner]) respond_to do |format| if @banner.save flash[:notice] = 'Banner adicionado com sucesso.' format.html { redirect_to()} format.xml { render :xml => @banner, :status => :created, :location => @banner } else format.html { render :action => "new" } format.xml { render :xml => @banner.errors, :status => :unprocessable_entity } end end end |
#crop ⇒ Object
92 93 94 |
# File 'app/controllers/banners_controller.rb', line 92 def crop @banner = Banner.find(params[:id]) end |
#destroy ⇒ Object
DELETE /banners/1 DELETE /banners/1.xml
82 83 84 85 86 87 88 89 90 |
# File 'app/controllers/banners_controller.rb', line 82 def destroy @banner = Banner.find(params[:id]) @banner.destroy respond_to do |format| format.html { redirect_to() } format.xml { head :ok } end end |
#edit ⇒ Object
GET /banners/1/edit
42 43 44 |
# File 'app/controllers/banners_controller.rb', line 42 def edit @banner = Banner.find(params[:id]) end |
#index ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/controllers/banners_controller.rb', line 10 def index @banners = Banner.paginate :page => params[:page], :per_page=>20 respond_to do |format| format.html # index.html.erb format.xml { render :xml => @banners } end end |
#new ⇒ Object
GET /banners/new GET /banners/new.xml
32 33 34 35 36 37 38 39 |
# File 'app/controllers/banners_controller.rb', line 32 def new @banner = Banner.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @banner } end end |
#show ⇒ Object
GET /banners/1 GET /banners/1.xml
21 22 23 24 25 26 27 28 |
# File 'app/controllers/banners_controller.rb', line 21 def show @banner = Banner.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @banner } end end |
#update ⇒ Object
PUT /banners/1 PUT /banners/1.xml
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/controllers/banners_controller.rb', line 65 def update @banner = Banner.find(params[:id]) respond_to do |format| if @banner.update_attributes(params[:banner]) flash[:notice] = 'Banner adicionado com sucesso.' format.html { redirect_to()} format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @banner.errors, :status => :unprocessable_entity } end end end |