rails-settings-cached 0.5.3 → 0.5.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: 74fabc2834f742715e6895cf947912ed2163091c
4
- data.tar.gz: 5ce1fe34a973c18775c7d1f174b075fd915ad95e
3
+ metadata.gz: 573145ca5a45516e138312ff9b35338e97b2a12b
4
+ data.tar.gz: 4e55fec2760056d075ae1cd330d5d26cc6cd7a0b
5
5
  SHA512:
6
- metadata.gz: 0bc45ee680505b1f3e90a199ad9c6e19ef9b474909aa35f7299bab8e434ad88a750e5a43c99c99ef15320cd36f20577aca74c7df4b071956fd2c3eb7a0d181f6
7
- data.tar.gz: 978f411bf5670ee779c55eded8d36f05f2d3d804f423884496ead9c3cc6d8929da99d3e89349617db9fd4dcf392a58ca0a673f1e0f068600a277454427cb4476
6
+ metadata.gz: 5844cac704005e2d797f1e6d9bcd770f480f84f3ee5eba29aae25f4a0e67466863ff14cdd94b2e95e955a5a07a8d19c85b31cfdb7318f141b42772e877147e03
7
+ data.tar.gz: f9dcf649734ed373921eaab2fee33257beb68e785841268c4eba98c1bb610172647bec696dd911a70f489852fc30bfe1aee1bf0f46c3065018f68c9d2ee66048
data/README.md CHANGED
@@ -9,8 +9,7 @@ of object. Strings, numbers, arrays, or any object.
9
9
 
10
10
  ## Status
11
11
 
12
- - [![Gem Version](https://badge.fury.io/rb/rails-settings-cached.png)](https://rubygems.org/gems/rails-settings-cached)
13
- - [![CI Status](https://api.travis-ci.org/huacnlee/rails-settings-cached.png)](http://travis-ci.org/huacnlee/rails-settings-cached)
12
+ [![Gem Version](https://badge.fury.io/rb/rails-settings-cached.svg)](https://rubygems.org/gems/rails-settings-cached) [![CI Status](https://api.travis-ci.org/huacnlee/rails-settings-cached.svg)](http://travis-ci.org/huacnlee/rails-settings-cached)
14
13
 
15
14
  ## Setup
16
15
 
@@ -36,6 +36,15 @@ module RailsSettings
36
36
  end
37
37
  end
38
38
 
39
+ # set a setting value by [] notation
40
+ def []=(var_name, value)
41
+ super
42
+
43
+ Rails.cache.write(cache_key(var_name, @object),value)
44
+
45
+ value
46
+ end
47
+
39
48
  def save_default(key, value)
40
49
  return false unless self[key].nil?
41
50
  self[key] = value
@@ -16,7 +16,7 @@ module RailsSettings
16
16
 
17
17
  # get the value field, YAML decoded
18
18
  def value
19
- YAML.load(self[:value])
19
+ YAML.load(self[:value]) if self[:value].present?
20
20
  end
21
21
 
22
22
  # set the value field, YAML encoded
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.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Squeegy
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-01-20 00:00:00.000000000 Z
14
+ date: 2016-03-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails