Sha256: f29199bed65235cf2f413ff6c0558efbddfde3911d5416126ad9277fc6f2ed40
Contents?: true
Size: 782 Bytes
Versions: 41
Compression:
Stored size: 782 Bytes
Contents
module EasySettings ## # EasySettings::FormModel # # Fake models/proxy for easy seettings. Usable in rails form. # # settings = EasySettings::FormModel.new(prefix: 'easy_gantt') # settings.show_holidays == EasySetting.value(:easy_gantt_show_holidays) # class FormModel def initialize(prefix: nil, project: nil) @prefix = "#{prefix}_" if prefix.present? @project_id = project.is_a?(Project) ? project.id : project end def model_name EasySetting.model_name end def persisted? true end def to_model self end # Called for missing :id parameter # # def to_param # end def method_missing(name, *args) EasySetting.value("#{@prefix}#{name}", @project_id) end end end
Version data entries
41 entries across 41 versions & 1 rubygems