Class: AdvertSelector::PlacementsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- AdvertSelector::PlacementsController
- Defined in:
- app/controllers/advert_selector/placements_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /placements POST /placements.json.
-
#destroy ⇒ Object
DELETE /placements/1 DELETE /placements/1.json.
-
#edit ⇒ Object
GET /placements/1/edit.
-
#index ⇒ Object
GET /placements GET /placements.json.
-
#new ⇒ Object
GET /placements/new GET /placements/new.json.
-
#show ⇒ Object
GET /placements/1 GET /placements/1.json.
-
#update ⇒ Object
PUT /placements/1 PUT /placements/1.json.
Methods inherited from ApplicationController
#admin_access_only, #set_locale, #set_time_zone
Instance Method Details
#create ⇒ Object
POST /placements POST /placements.json
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/advert_selector/placements_controller.rb', line 47 def create @placement = Placement.new(params[:placement]) respond_to do |format| if @placement.save format.html { redirect_to @placement, :notice => 'Placement was successfully created.' } format.json { render :json => @placement, :status => :created, :location => @placement } else format.html { render :action => "new" } format.json { render :json => @placement.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /placements/1 DELETE /placements/1.json
79 80 81 82 83 84 85 86 87 |
# File 'app/controllers/advert_selector/placements_controller.rb', line 79 def destroy @placement = Placement.find(params[:id]) @placement.destroy respond_to do |format| format.html { redirect_to placements_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /placements/1/edit
41 42 43 |
# File 'app/controllers/advert_selector/placements_controller.rb', line 41 def edit @placement = Placement.find(params[:id]) end |
#index ⇒ Object
GET /placements GET /placements.json
7 8 9 10 11 12 13 14 |
# File 'app/controllers/advert_selector/placements_controller.rb', line 7 def index @placements = Placement.all respond_to do |format| format.html # index.html.erb format.json { render :json => @placements } end end |
#new ⇒ Object
GET /placements/new GET /placements/new.json
31 32 33 34 35 36 37 38 |
# File 'app/controllers/advert_selector/placements_controller.rb', line 31 def new @placement = Placement.new respond_to do |format| format.html # new.html.erb format.json { render :json => @placement } end end |
#show ⇒ Object
GET /placements/1 GET /placements/1.json
18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/advert_selector/placements_controller.rb', line 18 def show redirect_to edit_placement_url(params[:id]) #@placement = Placement.find(params[:id]) # #respond_to do |format| # format.html # show.html.erb # format.json { render :json => @placement } #end end |
#update ⇒ Object
PUT /placements/1 PUT /placements/1.json
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/advert_selector/placements_controller.rb', line 63 def update @placement = Placement.find(params[:id]) respond_to do |format| if @placement.update_attributes(params[:placement]) format.html { redirect_to @placement, :notice => 'Placement was successfully updated.' } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @placement.errors, :status => :unprocessable_entity } end end end |