trabajo-afectivo/lib/application_lib.rb

30 lines
500 B
Ruby
Raw Permalink Normal View History

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
module ApplicationLib
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
2013-08-15 21:15:05 +00:00
=begin
load adapter based on setting option
result = self.load_adapter_by_setting('some_setting_with_class_name')
2013-08-15 21:15:05 +00:00
returns
2013-08-17 16:09:06 +00:00
result = Some::Classname
2013-08-15 21:15:05 +00:00
=end
def load_adapter_by_setting(setting)
adapter = Setting.get(setting)
2017-11-23 08:09:44 +00:00
return if adapter.blank?
adapter.constantize
end
end
end