rails-settings-cached 0.4.2 → 0.4.3

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: 4c9f513e434fb39d1cfefa3ff34bac2b079d6aa9
4
- data.tar.gz: 9d1c7c9775ab9108d5604bb1617f2bffde890e80
3
+ metadata.gz: 80bfa0c52c2d8fe8b4535ff364b0d727476f9e5c
4
+ data.tar.gz: ca264291977f18ee792e52191e6415974263ca13
5
5
  SHA512:
6
- metadata.gz: 992cc15c9cadd8298dab78168b42d4ddf60d784a3749ecf66b7e0b1535b18487aa7b763ea89771b0e6e61ff805cb831d1a6d3700a545c51d5ba88b0dc6279f4b
7
- data.tar.gz: 310666efc9ba502e62da3e7fd06f3282909c984fcee2518838c6ddd4c13b3045a9bd4dd485b8acd5c5beaeeca09789c04e46ef2b8f6d192a4c573e2d7a186a50
6
+ metadata.gz: 88de4555fb37729d39d6f1f2f6868fac66399662c2d0139bb59783e07760cd6ca225c45ad2e1d42b10095be5bf8dbe6e356f2961347805ef7394045ce145ac3f
7
+ data.tar.gz: 4bdbfc25e039ac4b95baad02f27002a81710cd5ad0378b95f18ccab8583edeef080daba0697f149240c646783c9292ebdc98f5064093078e1587669d5875984a
data/README.md CHANGED
@@ -18,7 +18,7 @@ Edit your Gemfile:
18
18
 
19
19
  ```ruby
20
20
  # Rails 4.1.x
21
- gem "rails-settings-cached", "0.4.1"
21
+ gem "rails-settings-cached", "~> 0.4.0"
22
22
  # Rails 4+
23
23
  gem "rails-settings-cached", "0.3.1"
24
24
  # Rails 3.x
@@ -1,11 +1,9 @@
1
1
  module RailsSettings
2
2
  class CachedSettings < Settings
3
- after_commit :rewrite_cache, on: %i(create update)
4
3
  def rewrite_cache
5
4
  Rails.cache.write("rails_settings_cached:#{var}", value)
6
5
  end
7
6
 
8
- after_commit :expire_cache, on: %i(destroy)
9
7
  def expire_cache
10
8
  Rails.cache.delete("rails_settings_cached:#{var}")
11
9
  end
@@ -21,8 +19,8 @@ module RailsSettings
21
19
  end
22
20
 
23
21
  def save_default(key, value)
24
- return false unless send(key).nil?
25
- send("#{key}=", value)
22
+ return false unless self[key].nil?
23
+ self[key] = value
26
24
  end
27
25
  end
28
26
  end
@@ -2,3 +2,10 @@ require_relative 'rails-settings/settings'
2
2
  require_relative 'rails-settings/scoped_settings'
3
3
  require_relative 'rails-settings/cached_settings'
4
4
  require_relative 'rails-settings/extend'
5
+
6
+ class RailsSettings::Railtie < Rails::Railtie
7
+ initializer "rails_settings.active_record.initialization" do
8
+ RailsSettings::CachedSettings.after_commit :rewrite_cache, on: %i(create update)
9
+ RailsSettings::CachedSettings.after_commit :expire_cache, on: %i(destroy)
10
+ end
11
+ 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.4.2
4
+ version: 0.4.3
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: 2015-08-27 00:00:00.000000000 Z
14
+ date: 2015-09-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails