Skip to content
Browse files

Move unit queueing to units controller

  • Loading branch information...
1 parent 274a08c commit a3bc082fc2b38ce47e1f3fb648b2fa5c4316564e @rwdaigle committed Mar 14, 2012
Showing with 9 additions and 10 deletions.
  1. +0 −6 app/controllers/subjects_controller.rb
  2. +8 −2 app/controllers/units_controller.rb
  3. +1 −2 config/routes.rb
View
6 app/controllers/subjects_controller.rb
@@ -48,12 +48,6 @@ def learn; redirect_to_next_learning end
def review; redirect_to_next_review; end
- def process_units
- $queue.enqueue('Subject.process!', current_object.id)
- flash[:notice] = "#{current_object} has been queued for processing of empty units."
- redirect_to current_object
- end
-
private
def force_seed
View
10 app/controllers/units_controller.rb
@@ -1,10 +1,10 @@
class UnitsController < ApplicationController
- before_filter :expose_subject_from_unit
+ before_filter :expose_subject_from_unit, :except => :queue
before_filter :ensure_ownership, :only => [:edit_question, :edit_answer, :update, :destroy]
make_resourceful do
- actions :all, :edit_question
+ actions :all, :edit_question, :queue
belongs_to :subject
response_for :create do |wants|
@@ -43,6 +43,12 @@ def update_question
current_object.update_attributes object_parameters
response_for :update_question
end
+
+ def queue
+ $queue.enqueue('Subject.process!', parent_object.id)
+ flash[:notice] = "#{parent_object} has been queued for processing of empty units."
+ redirect_to parent_object
+ end
# Need to get subject by permalink
def parent_object
View
3 config/routes.rb
@@ -26,10 +26,9 @@
get 'learn'
get 'review'
get 'quiz'
- get 'process_units'
end
resources :units do
- get 'process_all', :on => :collection
+ get 'queue', :on => :collection
end
resources :learnings do
get 'today', :on => :collection

0 comments on commit a3bc082

Please sign in to comment.
Something went wrong with that request. Please try again.