Permalink
Browse files

Process units after creation w/ observer

  • Loading branch information...
1 parent b241d0b commit 1d3423f5ac90f08e816d108be7a321343b587e89 @rwdaigle committed Jun 4, 2012
Showing with 2 additions and 9 deletions.
  1. +1 −2 app/models/unit.rb
  2. +1 −1 app/models/unit_observer.rb
  3. +0 −6 lib/tasks/ptls.rake
View
@@ -6,7 +6,6 @@ class Unit < ActiveRecord::Base
validates_uniqueness_of :question, :scope => :subject_id
before_save :normalize_question, :set_processor_type
- after_create :process!
belongs_to :subject
has_many :learnings, :dependent => :delete_all
@@ -60,7 +59,7 @@ def empty?
def process!(overwrite = false)
if overwrite || empty?
with_processor do |processor_klass|
- $queue.enqueue("#{processor_klass}.process!", id)
+ processor_klass.process!(id)
end
end
end
@@ -3,6 +3,6 @@ class UnitObserver < ActiveRecord::Observer
observe :unit
def after_create(unit)
- # log(unit) { $queue.enqueue('Unit.process!', unit.id) }
+ $queue.enqueue('Unit.process!', unit.id)
end
end
View
@@ -1,11 +1,5 @@
namespace :ptls do
- # desc "Auto translate the units of the SUBJECT_ID env variable"
- # task :translate => :environment do
- # subject = Subject.find(ENV['SUBJECT_ID'])
- # subject.translate if subject
- # end
-
desc "Load words from external sources"
task :load => :environment do
[WordnikWODLoader].each do |klass| # CSVLoader

0 comments on commit 1d3423f

Please sign in to comment.