class 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)
Public Class Methods
Source
# File lib/redmine_extensions/easy_settings/form_model.rb, line 12 def initialize(prefix: nil, project: nil) @prefix = "#{prefix}_" if prefix.present? @project_id = project.is_a?(Project) ? project.id : project end
Public Instance Methods
Source
# File lib/redmine_extensions/easy_settings/form_model.rb, line 34 def method_missing(name, *args) EasySetting.value("#{@prefix}#{name}", @project_id) end
Called for missing :id parameter
def to_param end
Source
# File lib/redmine_extensions/easy_settings/form_model.rb, line 17 def model_name EasySetting.model_name end
Source
# File lib/redmine_extensions/easy_settings/form_model.rb, line 21 def persisted? true end
Source
# File lib/redmine_extensions/easy_settings/form_model.rb, line 25 def to_model self end