module Actionable::Target
Attributes
actionable_errors[RW]
actionable_ids[RW]
Public Instance Methods
actionables()
click to toggle source
# File lib/actionable/target.rb, line 11 def actionables @actionables ||= Actionable::Action.where(target_id: id) end
schedule_actionable(execution_time,job_class_name,payload={}) { |actionable| ... }
click to toggle source
# File lib/actionable/target.rb, line 19 def schedule_actionable(execution_time,job_class_name,payload={}) # force memoized values to refresh @actionables = nil @actionable_errors = nil # set model values actionable = Actionable::Action.build( target_id:id, target_class_name: self.class.to_s, payload: payload, execution_time: execution_time.to_datetime.utc, job_class_name: job_class_name ) # yield the model to a block for # situation-specific adjustments yield(actionable) if block_given? # set status to saved now that # initialization is complete actionable.status = :scheduled # save the new model record unless actionable.save # keep error values around for inspection @actionable_errors = actionable.errors false end true end