Class: ReleasesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ReleasesController
- Defined in:
- lib/branston/app/controllers/releases_controller.rb
Overview
This file is part of Branston.
Branston is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation.
Branston is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Branston. If not, see <http://www.gnu.org/licenses/>.
Instance Method Summary collapse
-
#create ⇒ Object
POST /releases POST /releases.xml.
-
#destroy ⇒ Object
DELETE /releases/1 DELETE /releases/1.xml.
-
#edit ⇒ Object
GET /releases/1/edit.
-
#index ⇒ Object
GET /releases GET /releases.xml.
-
#new ⇒ Object
GET /releases/new GET /releases/new.xml.
-
#show ⇒ Object
GET /releases/1 GET /releases/1.xml.
-
#update ⇒ Object
PUT /releases/1 PUT /releases/1.xml.
Instance Method Details
#create ⇒ Object
POST /releases POST /releases.xml
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/branston/app/controllers/releases_controller.rb', line 63 def create @release = Release.new(params[:release]) respond_to do |format| if @release.save flash[:notice] = 'Release was successfully created.' format.html { redirect_to(@release) } format.xml { render :xml => @release, :status => :created, :location => @release } else format.html { render :action => "new" } format.xml { render :xml => @release.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /releases/1 DELETE /releases/1.xml
97 98 99 100 101 102 103 104 105 |
# File 'lib/branston/app/controllers/releases_controller.rb', line 97 def destroy @release = Release.find(params[:id]) @release.destroy respond_to do |format| format.html { redirect_to(releases_url) } format.xml { head :ok } end end |
#edit ⇒ Object
GET /releases/1/edit
57 58 59 |
# File 'lib/branston/app/controllers/releases_controller.rb', line 57 def edit @release = Release.find(params[:id]) end |
#index ⇒ Object
GET /releases GET /releases.xml
25 26 27 28 29 30 31 32 |
# File 'lib/branston/app/controllers/releases_controller.rb', line 25 def index @releases = Release.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @releases } end end |
#new ⇒ Object
GET /releases/new GET /releases/new.xml
47 48 49 50 51 52 53 54 |
# File 'lib/branston/app/controllers/releases_controller.rb', line 47 def new @release = Release.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @release } end end |
#show ⇒ Object
GET /releases/1 GET /releases/1.xml
36 37 38 39 40 41 42 43 |
# File 'lib/branston/app/controllers/releases_controller.rb', line 36 def show @release = Release.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @release } end end |
#update ⇒ Object
PUT /releases/1 PUT /releases/1.xml
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/branston/app/controllers/releases_controller.rb', line 80 def update @release = Release.find(params[:id]) respond_to do |format| if @release.update_attributes(params[:release]) flash[:notice] = 'Release was successfully updated.' format.html { redirect_to(@release) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @release.errors, :status => :unprocessable_entity } end end end |