lib/qujo/concerns/common.rb in qujo-0.1.2 vs lib/qujo/concerns/common.rb in qujo-0.1.3
- old
+ new
@@ -3,16 +3,12 @@
module Common
extend ActiveSupport::Concern
included do
extend ClassMethods
- attr_accessor :model, :parent
def run
- #self.load_model
- #self.load_parent
-
self.status = :working
self.save!
self.work
@@ -40,37 +36,9 @@
sleep interval
count += 1
end
raise "wait timeout count=#{count} interval=#{interval} maximum=#{maximum}" if ((count * interval) >= maximum)
end
-
- #def model
- # @model ||= begin
- # if data && data["id"] && data["class"]
- # begin
- # c = data["class"].constantize
- # c.find(data["id"]) # rescue nil #TODO: make this smarter
- # #rescue Mongoid::Errors::DocumentNotFound => e
- # # logger.error "document not found"
- # # nil
- # end
- # end
- # end
- #end
- #
- #def parent
- # @parent ||= begin
- # if data["parent"] && data["parent"]["type"] && data["parent"]["id"]
- # begin
- # c = data["parent"]["type"].constantize
- # c.find(data["parent"]["id"])
- # #rescue Mongoid::Errors::DocumentNotFound => e
- # # logger.error "document not found"
- # # nil
- # end
- # end
- # end
- #end
def model
@model ||= begin
if data && data["model"] && data["model"]["id"] && data["model"]["class"]
i = data["model"]["id"]