Loading validations from the database

Hi everyone, i am trying to load validations from database. It is done in its’ most part but what i cannot do is change a validation without restarting the server.

What i basically do is as follows: I have created a Setting model & controller. Every model has its’ own settings. It is a text column where i save a json string. As seen in the normal way validations are written inside a model, they are loaded once after restarting the server. I wrote a module Validations which i include in every model as follows:

include Validations

class User < ApplicationRecord
  has_secure_password
  belongs_to :company
  belongs_to :vuser
  has_many :purchase_orders

    class << self
      attr_accessor :validations_loaded
    end

    def self.load_validations
      # Load validations from database
      load_validations_from_db
    end
end


The validations_loaded is used as a global var in order to know if the validations were loaded so that to prevent multiple calls to load_validations_from_db() .

Is there a way to change a validation without restarting the server?

Regards Manos