Class: Apify::Scheduler::UnitsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Apify::Scheduler::UnitsController
- Defined in:
- app/controllers/apify/scheduler/units_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /units.
-
#destroy ⇒ Object
DELETE /units/1.
-
#edit ⇒ Object
GET /units/1/edit.
-
#index ⇒ Object
GET /units.
-
#new ⇒ Object
GET /units/new.
-
#perform ⇒ Object
POST /units/1/perform.
-
#show ⇒ Object
GET /units/1.
-
#update ⇒ Object
PATCH/PUT /units/1.
Instance Method Details
#create ⇒ Object
POST /units
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/apify/scheduler/units_controller.rb', line 28 def create @unit = Apify::Scheduler::Unit.new(unit_params) if @unit.save redirect_to @unit, notice: 'Unit was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE /units/1
56 57 58 59 |
# File 'app/controllers/apify/scheduler/units_controller.rb', line 56 def destroy @unit.destroy redirect_to units_url, notice: 'Unit was successfully destroyed.' end |
#edit ⇒ Object
GET /units/1/edit
24 25 |
# File 'app/controllers/apify/scheduler/units_controller.rb', line 24 def edit end |
#index ⇒ Object
GET /units
10 11 12 |
# File 'app/controllers/apify/scheduler/units_controller.rb', line 10 def index @units = Apify::Scheduler::Unit.all end |
#new ⇒ Object
GET /units/new
19 20 21 |
# File 'app/controllers/apify/scheduler/units_controller.rb', line 19 def new @unit = Apify::Scheduler::Unit.new end |
#perform ⇒ Object
POST /units/1/perform
48 49 50 51 52 53 |
# File 'app/controllers/apify/scheduler/units_controller.rb', line 48 def perform worker = @unit.enqueue = worker ? "Successfully added #{@unit.name} unit to queue. Refresh page to see progress." : "Error occured while queuing #{@unit.name}. Try again" flash_key = worker ? :notice : :error redirect_to units_path, flash: { flash_key => } end |
#show ⇒ Object
GET /units/1
15 16 |
# File 'app/controllers/apify/scheduler/units_controller.rb', line 15 def show end |
#update ⇒ Object
PATCH/PUT /units/1
39 40 41 42 43 44 45 |
# File 'app/controllers/apify/scheduler/units_controller.rb', line 39 def update if @unit.update(unit_params) redirect_to @unit, notice: 'Unit was successfully updated.' else render :edit end end |