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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e01ef7244de1ef5d6eb675ee35be6a3cd3baf30
4
- data.tar.gz: 98d27f6849d3af2369178216b78d7e39bf0f7190
3
+ metadata.gz: bce2b99239c2fbded5d529b7f225806c206e44f6
4
+ data.tar.gz: 7a069f5b6bb5d95d8f280618997a3f65f4730370
5
5
  SHA512:
6
- metadata.gz: 79c90693642f8a4fa8519b9e1e3c7cfc2c38f07825205c5fb980138d4d162e825ae5b02d75f8f28fee17119eb46e4f5388cc02320406de28cdb8987e7160c63c
7
- data.tar.gz: ff9930ae7a1ef61bc79c203ebcc9e364939fe750d2fa3e8c68019fb4ee6e85ce9fca1503fac31e598cee08b1f10c8a65d4326e6f667cf144fb3e23d7a7925245
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 = YAML.load(params[: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)
@@ -1,5 +1,5 @@
1
1
  # RailsSettings Model
2
- class <%= class_name %> < RailsSettings::CachedSettings
2
+ class <%= class_name %> < RailsSettings::Base
3
3
  source Rails.root.join("config/app.yml")
4
4
  namespace Rails.env
5
5
  end
@@ -14,7 +14,9 @@ module RailsSettings
14
14
 
15
15
  class << self
16
16
  def cache_prefix_by_startup
17
- @cache_prefix_by_startup ||= Time.now.to_f.to_s
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 = ["rails_settings_cached", cache_prefix_by_startup]
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
@@ -1,3 +1,5 @@
1
+ require 'digest/md5'
2
+
1
3
  module RailsSettings
2
4
  class Default < ::Hash
3
5
  class MissingKey < StandardError; end
@@ -1,7 +1,7 @@
1
1
  module RailsSettings
2
2
  class << self
3
3
  def version
4
- "0.6.3"
4
+ '0.6.4'
5
5
  end
6
6
  end
7
7
  end
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.3
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-04-27 00:00:00.000000000 Z
14
+ date: 2016-05-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails