Sha256: 08647e968eb2e60f61c5db459e5b9bd6a7140c77e343e51c58535273ebc90bb0
Contents?: true
Size: 675 Bytes
Versions: 19
Compression:
Stored size: 675 Bytes
Contents
module Merit class BaseTargetFinder def self.find(*args) new(*args).find end def initialize(rule, action) @rule = rule @action = action end def find get_target_from_database || reanimate_target_from_action rescue => e Rails.logger.warn "[merit] no target found: #{e}. #{caller.first}" end def get_target_from_database model_class.find_by_id(@action.target_id) end def model_class klass_name = (@rule.model_name || @action.target_model).singularize klass_name.camelize.constantize end def reanimate_target_from_action YAML.load(@action.target_data) end end end
Version data entries
19 entries across 19 versions & 2 rubygems