lib/merit/rules_rank.rb
def check_rank_rules
      defined_rules.each do |scoped_model, level_and_rules|
        level_and_rules = level_and_rules.sort
        level_and_rules.each do |level, rule|
          begin
            scoped_model.where("#{rule.level_name} < #{level}").each do |obj|
              if rule.applies?(obj)
                obj.update_attribute rule.level_name, level
              end
            end
          rescue ActiveRecord::StatementInvalid
            Rails.logger.warn "[merit] Please add #{rule.level_name} column/attribute to #{scoped_model.new.class.name}"
          end
        end
      end
    end
# Check rules defined for a merit_action
Check rules defined for a merit_action
Check rules defined for a merit_action
def check_rank_rules
      defined_rules.each do |scoped_model, level_and_rules|
        level_and_rules = level_and_rules.sort
        level_and_rules.each do |level, rule|
          begin
            scoped_model.where("#{rule.level_name} < #{level}").each do |obj|
              if rule.applies?(obj)
                obj.update_attribute rule.level_name, level
              end
            end
          rescue ActiveRecord::StatementInvalid
            Rails.logger.warn "[merit] Please add #{rule.level_name} column/attribute to #{scoped_model.new.class.name}"
          end
        end
      end
    end
def check_rank_rules defined_rules . each do | scoped_model , level_and_rules | level_and_rules = level_and_rules . sort level_and_rules . each do | level , rule | begin scoped_model . where ( "#{rule.level_name} < #{level}" ) . each do | obj | if rule . applies? ( obj ) obj . update_attribute rule . level_name , level end end rescue ActiveRecord :: StatementInvalid Rails . logger . warn "[merit] Please add #{rule.level_name} column/attribute to #{scoped_model.new.class.name}" end end end end
Check rules defined for a merit_action
Check rules defined for a merit_action