translated_attributes 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/translated_attributes/caching.rb +18 -0
- data/translated_attributes.gemspec +3 -2
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# include into your AR models to get caching (expires when models updated_at changes)
|
2
|
+
module TranslatedAttributes::Caching
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
def merge_db_translations_with_instance_variable_with_cache
|
6
|
+
key = "translated_attributes_#{cache_key}"
|
7
|
+
if cached = Rails.cache.read key
|
8
|
+
@translated_attributes = cached
|
9
|
+
@db_translations_merged = true
|
10
|
+
else
|
11
|
+
merge_db_translations_with_instance_variable_without_cache
|
12
|
+
Rails.cache.write key, @translated_attributes
|
13
|
+
end
|
14
|
+
end
|
15
|
+
alias_method_chain :merge_db_translations_with_instance_variable, :cache
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{translated_attributes}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-08-04}
|
13
13
|
s.email = %q{michael@grosser.it}
|
14
14
|
s.files = [
|
15
15
|
"Gemfile",
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
"lib/generators/translated_attributes/templates/migration.rb",
|
23
23
|
"lib/generators/translated_attributes/translated_attributes_generator.rb",
|
24
24
|
"lib/translated_attributes.rb",
|
25
|
+
"lib/translated_attributes/caching.rb",
|
25
26
|
"spec/integration_spec.rb",
|
26
27
|
"spec/models.rb",
|
27
28
|
"spec/spec_helper.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: translated_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 1
|
10
|
+
version: 0.6.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Grosser
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-04 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- lib/generators/translated_attributes/templates/migration.rb
|
66
66
|
- lib/generators/translated_attributes/translated_attributes_generator.rb
|
67
67
|
- lib/translated_attributes.rb
|
68
|
+
- lib/translated_attributes/caching.rb
|
68
69
|
- spec/integration_spec.rb
|
69
70
|
- spec/models.rb
|
70
71
|
- spec/spec_helper.rb
|