rails-settings-cached 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,13 +6,14 @@ module RailsSettings
6
6
  Rails.cache.write("settings:#{self.var}", self.value)
7
7
  end
8
8
 
9
- before_destroy { |record| Rails.cache.delete("settings:#{record.var}") }
9
+ after_destroy { |record| Rails.cache.delete("settings:#{record.var}") }
10
10
 
11
11
 
12
12
  def self.[](var_name)
13
- Rails.cache.fetch("settings:#{var_name}") {
13
+ obj = Rails.cache.fetch("settings:#{var_name}") {
14
14
  super(var_name)
15
15
  }
16
+ obj || @@defaults[var_name.to_s]
16
17
  end
17
18
  end
18
19
  end
@@ -91,7 +91,7 @@ module RailsSettings
91
91
  end
92
92
 
93
93
  def self.object(var_name)
94
- thing_scoped.find_by_var(var_name.to_s)
94
+ thing_scoped.where(:var => var_name.to_s).first
95
95
  end
96
96
 
97
97
  #get the value field, YAML decoded
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.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,11 +12,11 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2011-01-14 00:00:00.000000000 Z
15
+ date: 2012-11-26 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
19
- requirement: !ruby/object:Gem::Requirement
19
+ requirement: &70170716794980 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ! '>='
@@ -24,12 +24,7 @@ dependencies:
24
24
  version: 3.0.0
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: 3.0.0
27
+ version_requirements: *70170716794980
33
28
  description:
34
29
  email: huacnlee@gmail.com
35
30
  executables: []
@@ -65,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
60
  version: '0'
66
61
  requirements: []
67
62
  rubyforge_project:
68
- rubygems_version: 1.8.24
63
+ rubygems_version: 1.8.11
69
64
  signing_key:
70
65
  specification_version: 3
71
66
  summary: This is imporved from rails-settings, added caching. Settings is a plugin
@@ -75,4 +70,3 @@ summary: This is imporved from rails-settings, added caching. Settings is a plug
75
70
  into your rails app. You can store any kind of object. Strings, numbers, arrays,
76
71
  or any object. Ported to Rails 3!
77
72
  test_files: []
78
- has_rdoc: