源码安装 homeland 报错,请高手帮看下 (3.1.0)版本 setting.rb 代码如下:
# frozen_string_literal: true
# RailsSettings Model
class Setting < RailsSettings::Base
source Rails.root.join("config/config.yml")
class << self
def field(key, default: nil, type: :string, separator: nil)
self.class.define_method(key) do
val = self[key]
default = default.call if default.is_a?(Proc)
return default if val.nil?
val
end
if type == :boolean
self.class.define_method("#{key}?") do
val = self.send(key.to_sym)
val == "true" || val == "1"
end
elsif type == :array
self.class.define_method("#{key.to_s.singularize}_list") do
val = self.send(key.to_sym) || ""
separator = SEPARATOR_REGEXP if separator.nil?
val.split(separator).reject { |str| str.empty? }
end
end
end
end:relieved: :relieved: :relieved: :relieved: :relieved: