rails-settings-cached 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/lib/generators/settings/templates/model.rb +1 -1
- data/lib/rails-settings/base.rb +4 -2
- data/lib/rails-settings/default.rb +2 -0
- data/lib/rails-settings/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bce2b99239c2fbded5d529b7f225806c206e44f6
|
4
|
+
data.tar.gz: 7a069f5b6bb5d95d8f280618997a3f65f4730370
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b42abe0ebe5799e0ac1dc0cf80029d6213284647befb0139e2df75e4ffe2e1e4064245b84a99548b387391f3ad5131cbbe6fd80bceb356bfb148008b29611fa6
|
7
|
+
data.tar.gz: e5235b9c6f0f958cdddec08359efd1c80e41359f719287fa8a33d5e06c10c135c1dc48a36450024f7e828d890aea01867454d1a8fce4a2632050542a5257119a
|
data/README.md
CHANGED
@@ -216,7 +216,7 @@ module Admin
|
|
216
216
|
|
217
217
|
def update
|
218
218
|
if @setting.value != params[:setting][:value]
|
219
|
-
@setting.value =
|
219
|
+
@setting.value = params[:setting][:value]
|
220
220
|
@setting.save
|
221
221
|
redirect_to admin_settings_path, notice: 'Setting has updated.'
|
222
222
|
else
|
@@ -226,7 +226,6 @@ module Admin
|
|
226
226
|
|
227
227
|
def get_setting
|
228
228
|
@setting = Setting.find_by(var: params[:id]) || Setting.new(var: params[:id])
|
229
|
-
@setting[:value] = Setting[params[:id]]
|
230
229
|
end
|
231
230
|
end
|
232
231
|
end
|
@@ -261,3 +260,7 @@ app/views/admin/settings/edit.html.erb
|
|
261
260
|
|
262
261
|
Also you may use [rails-settings-ui](https://github.com/accessd/rails-settings-ui) gem
|
263
262
|
for building ready to using interface with validations.
|
263
|
+
|
264
|
+
## Use case:
|
265
|
+
|
266
|
+
- [ruby-china/ruby-china](https://github.com/ruby-china/ruby-china)
|
data/lib/rails-settings/base.rb
CHANGED
@@ -14,7 +14,9 @@ module RailsSettings
|
|
14
14
|
|
15
15
|
class << self
|
16
16
|
def cache_prefix_by_startup
|
17
|
-
@cache_prefix_by_startup
|
17
|
+
return @cache_prefix_by_startup if defined? @cache_prefix_by_startup
|
18
|
+
return '' unless Default.enabled?
|
19
|
+
@cache_prefix_by_startup = Digest::MD5.hexdigest(Default.instance.to_s)
|
18
20
|
end
|
19
21
|
|
20
22
|
def cache_prefix(&block)
|
@@ -22,7 +24,7 @@ module RailsSettings
|
|
22
24
|
end
|
23
25
|
|
24
26
|
def cache_key(var_name, scope_object)
|
25
|
-
scope = [
|
27
|
+
scope = ['rails_settings_cached', cache_prefix_by_startup]
|
26
28
|
scope << @cache_prefix.call if @cache_prefix
|
27
29
|
scope << "#{scope_object.class.name}-#{scope_object.id}" if scope_object
|
28
30
|
scope << var_name.to_s
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-settings-cached
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|