Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Process units after creation w/ observer

  • Loading branch information...
commit 1d3423f5ac90f08e816d108be7a321343b587e89 1 parent b241d0b
@rwdaigle authored
View
3  app/models/unit.rb
@@ -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
View
2  app/models/unit_observer.rb
@@ -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
6 lib/tasks/ptls.rake
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.