rails-settings-cached 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails-settings-cached.rb +1 -6
- data/lib/rails-settings/base.rb +1 -0
- data/lib/rails-settings/railtie.rb +8 -0
- data/lib/rails-settings/settings.rb +7 -1
- data/lib/rails-settings/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 814ca9dffbaac78275816924d159c1eda85a5031
|
4
|
+
data.tar.gz: 8dc29d44e8b5aa3c5f10a3fc4fe46943f25d04d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ec4e326eecb245cb60b88402e0c6e6f9bf33c5499e5cfe1ca5bbab0a5a8136c572e38e4e870f9fdc02ff6f01cfa1a66a7ba71b2c7a4bf7b4bd1854a195584c6
|
7
|
+
data.tar.gz: 28209a07180e319b2f64d555e676c52be74b12c25f01d71be8a6a4b4803ce02d468fee4f3ab9e19097ebe04a2b78a88bae675935529c0223643890e82002a0f6
|
@@ -4,13 +4,8 @@ require_relative 'rails-settings/cached_settings'
|
|
4
4
|
require_relative 'rails-settings/scoped_settings'
|
5
5
|
require_relative 'rails-settings/default'
|
6
6
|
require_relative 'rails-settings/extend'
|
7
|
+
require_relative 'rails-settings/railtie'
|
7
8
|
require_relative 'rails-settings/version'
|
8
9
|
|
9
10
|
module RailsSettings
|
10
|
-
class Railtie < Rails::Railtie
|
11
|
-
initializer "rails_settings.active_record.initialization" do
|
12
|
-
RailsSettings::Base.after_commit :rewrite_cache, on: %i(create update)
|
13
|
-
RailsSettings::Base.after_commit :expire_cache, on: %i(destroy)
|
14
|
-
end
|
15
|
-
end
|
16
11
|
end
|
data/lib/rails-settings/base.rb
CHANGED
@@ -0,0 +1,8 @@
|
|
1
|
+
module RailsSettings
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
initializer "rails_settings.active_record.initialization" do
|
4
|
+
RailsSettings::Base.after_commit :rewrite_cache, on: %i(create update)
|
5
|
+
RailsSettings::Base.after_commit :expire_cache, on: %i(destroy)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
@@ -104,7 +104,9 @@ module RailsSettings
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def object(var_name)
|
107
|
-
|
107
|
+
return nil unless rails_initialized?
|
108
|
+
return nil unless table_exists?
|
109
|
+
thing_scoped.where(var: var_name.to_s).first
|
108
110
|
end
|
109
111
|
|
110
112
|
def thing_scoped
|
@@ -114,6 +116,10 @@ module RailsSettings
|
|
114
116
|
def source(filename)
|
115
117
|
Default.source(filename)
|
116
118
|
end
|
119
|
+
|
120
|
+
def rails_initialized?
|
121
|
+
Rails.application && Rails.application.initialized?
|
122
|
+
end
|
117
123
|
end
|
118
124
|
end
|
119
125
|
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.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/rails-settings/cached_settings.rb
|
49
49
|
- lib/rails-settings/default.rb
|
50
50
|
- lib/rails-settings/extend.rb
|
51
|
+
- lib/rails-settings/railtie.rb
|
51
52
|
- lib/rails-settings/scoped_settings.rb
|
52
53
|
- lib/rails-settings/settings.rb
|
53
54
|
- lib/rails-settings/version.rb
|