Permalink
Browse files

Automatically process units on creation

  • Loading branch information...
1 parent fba083e commit c9d7d3e7a3fdbadd65325e8df8cb5067de059cd9 @rwdaigle committed Jun 1, 2012
Showing with 2 additions and 7 deletions.
  1. +2 −7 app/models/unit.rb
View
@@ -6,6 +6,7 @@ class Unit < ActiveRecord::Base
validates_uniqueness_of :question, :scope => :subject_id
before_save :normalize_question
+ after_create :process!
belongs_to :subject
has_many :learnings, :dependent => :delete_all
@@ -54,13 +55,7 @@ def <=>(other)
end
def process!(overwrite = false)
- log(subject, self, { 'overwrite' => overwrite }) do
- if answer.blank? || overwrite
- subject.with_processor do |processor_klass|
- processor_klass.process!(self, unit)
- end
- end
- end
+ $queue.enqueue("WordnikProcessor.process!", id) if answer.blank? || overwrite
end
def to_log

0 comments on commit c9d7d3e

Please sign in to comment.