Class: RailsAdserver::AdspacesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RailsAdserver::AdspacesController
- Defined in:
- app/controllers/rails_adserver/adspaces_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /adspaces POST /adspaces.json.
-
#destroy ⇒ Object
DELETE /adspaces/1 DELETE /adspaces/1.json.
-
#edit ⇒ Object
GET /adspaces/1/edit.
-
#index ⇒ Object
GET /adspaces GET /adspaces.json.
-
#new ⇒ Object
GET /adspaces/new GET /adspaces/new.json.
-
#show ⇒ Object
GET /adspaces/1 GET /adspaces/1.json.
-
#update ⇒ Object
PUT /adspaces/1 PUT /adspaces/1.json.
Instance Method Details
#create ⇒ Object
POST /adspaces POST /adspaces.json
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/rails_adserver/adspaces_controller.rb', line 45 def create @title = "New Ad-Space" @adspace = Adspace.new(params[:adspace]) respond_to do |format| if @adspace.save format.html { redirect_to adspaces_url, notice: 'Adspace was successfully created.' } format.json { render json: @adspace, status: :created, location: @adspace } else format.html { render action: "new" } format.json { render json: @adspace.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /adspaces/1 DELETE /adspaces/1.json
77 78 79 80 81 82 83 84 85 |
# File 'app/controllers/rails_adserver/adspaces_controller.rb', line 77 def destroy @adspace = Adspace.find(params[:id]) @adspace.destroy respond_to do |format| format.html { redirect_to adspaces_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /adspaces/1/edit
38 39 40 41 |
# File 'app/controllers/rails_adserver/adspaces_controller.rb', line 38 def edit @title = "Edit Ad-Space" @adspace = Adspace.find(params[:id]) end |
#index ⇒ Object
GET /adspaces GET /adspaces.json
6 7 8 9 10 11 12 13 |
# File 'app/controllers/rails_adserver/adspaces_controller.rb', line 6 def index @title = "Ad-Spaces" @adspaces = Adspace.all respond_to do |format| format.html # index.html.erb format.json { render json: @adspaces } end end |
#new ⇒ Object
GET /adspaces/new GET /adspaces/new.json
28 29 30 31 32 33 34 35 |
# File 'app/controllers/rails_adserver/adspaces_controller.rb', line 28 def new @title = "New Ad-Space" @adspace = Adspace.new respond_to do |format| format.html # new.html.erb format.json { render json: @adspace } end end |
#show ⇒ Object
GET /adspaces/1 GET /adspaces/1.json
17 18 19 20 21 22 23 24 |
# File 'app/controllers/rails_adserver/adspaces_controller.rb', line 17 def show @adspace = Adspace.find(params[:id]) @tile = "Ad-Space - #{@adspace.name}" respond_to do |format| format.html # show.html.erb format.json { render json: @adspace } end end |
#update ⇒ Object
PUT /adspaces/1 PUT /adspaces/1.json
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/rails_adserver/adspaces_controller.rb', line 61 def update @title = "Edit Ad-Space" @adspace = Adspace.find(params[:id]) respond_to do |format| if @adspace.update_attributes(params[:adspace]) format.html { redirect_to @adspace, notice: 'Adspace was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @adspace.errors, status: :unprocessable_entity } end end end |