]>
cat aescling's git repositories - mastodon.git/blob - app/models/setting.rb
1 # frozen_string_literal: true
2 # == Schema Information
6 # id :bigint(8) not null, primary key
10 # created_at :datetime
11 # updated_at :datetime
15 class Setting
< RailsSettings
::Base
16 source Rails
.root
.join('config', 'settings.yml')
24 return super(key
) unless rails_initialized
?
26 val
= Rails
.cache
.fetch(cache_key(key
, nil)) do
30 default_value
= default_settings
[key
]
32 return default_value
.with_indifferent_access
.merge!
(db_val
.value
) if default_value
.is_a
?(Hash
)
43 records
= vars
.each_with_object({}) { |r
, h
| h
[r
.var
] = r
}
45 default_settings
.each
do |key
, default_value
|
46 next if records
.key
?(key
) || default_value
.is_a
?(Hash
)
47 records
[key
] = Setting
.new(var
: key
, value
: default_value
)
54 return {} unless RailsSettings
::Default.enabled
?
55 RailsSettings
::Default.instance
This page took 0.084028 seconds and 4 git commands to generate.