Class: AdSpace::SlotsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- AdSpace::SlotsController
- Defined in:
- app/controllers/ad_space/slots_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /slots.
-
#destroy ⇒ Object
DELETE /slots/1.
-
#edit ⇒ Object
GET /slots/1/edit.
-
#index ⇒ Object
GET /slots.
-
#new ⇒ Object
GET /slots/new.
- #remove_demo ⇒ Object
-
#show ⇒ Object
GET /slots/1.
-
#update ⇒ Object
PATCH/PUT /slots/1.
Methods inherited from ApplicationController
#_current_user, #add_breadcrumb, #breadcrumbs, #init_app
Instance Method Details
#create ⇒ Object
POST /slots
31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/ad_space/slots_controller.rb', line 31 def create @slot = Slot.new(slot_params) if @slot.save redirect_to @slot, notice: "Slot was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /slots/1
51 52 53 54 |
# File 'app/controllers/ad_space/slots_controller.rb', line 51 def destroy @slot.destroy! redirect_to slots_url, notice: "Slot was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
GET /slots/1/edit
26 27 28 |
# File 'app/controllers/ad_space/slots_controller.rb', line 26 def edit (t("home"), root_path) end |
#index ⇒ Object
GET /slots
6 7 8 9 10 |
# File 'app/controllers/ad_space/slots_controller.rb', line 6 def index @slots = Slot.all (t("home"), root_path) end |
#new ⇒ Object
GET /slots/new
19 20 21 22 23 |
# File 'app/controllers/ad_space/slots_controller.rb', line 19 def new @slot = Slot.new (t("home"), root_path) end |
#remove_demo ⇒ Object
56 57 58 59 60 |
# File 'app/controllers/ad_space/slots_controller.rb', line 56 def remove_demo @slot.demo.purge if @slot.demo.attached? render json: { success: true } end |
#show ⇒ Object
GET /slots/1
13 14 15 16 |
# File 'app/controllers/ad_space/slots_controller.rb', line 13 def show (t("home"), root_path) (t("slots"), slots_path) end |
#update ⇒ Object
PATCH/PUT /slots/1
42 43 44 45 46 47 48 |
# File 'app/controllers/ad_space/slots_controller.rb', line 42 def update if @slot.update(slot_params) redirect_to @slot, notice: "Slot was successfully updated.", status: :see_other else render :edit, status: :unprocessable_entity end end |