translated_attribute_value 0.0.2a → 0.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7512b92b1846fce309b74c318844f242b2134c1f
|
4
|
+
data.tar.gz: 46d0e02b6a1dc4da4563cbec842ab7f48f18ebc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58a03bc5142e696e41c25a0076aab8efee844032c3f9978fc23b5de0342be8500c88f69d7ef9a23543fa1efbc02ff432f7b6c783aa070de08f64f5be11ffbe2a
|
7
|
+
data.tar.gz: 26fc9ce26e944b172786915bea34e155f2c4e7637dcb47fa48ae58cde0827afdbfe375556bdb12f9448e8695062494342647aabeecf3b9e32997f6e11967c378
|
@@ -10,17 +10,17 @@ module TranslatedAttributeValue
|
|
10
10
|
if defined?(ActiveRecord::Base)
|
11
11
|
self.send(:define_method, "#{attribute_name}_translated") do
|
12
12
|
attribute_value = self.send(attribute_name)
|
13
|
-
I18n.t("activerecord.attributes
|
13
|
+
I18n.t("activerecord.attributes.user.#{attribute_name}_translation.#{attribute_value}")
|
14
14
|
end
|
15
15
|
elsif defined?(Mongoid::Document)
|
16
16
|
self.send(:define_method, "#{attribute_name}_translated") do
|
17
17
|
attribute_value = self.send(attribute_name)
|
18
|
-
I18n.t("mongoid.attributes
|
18
|
+
I18n.t("mongoid.attributes.user.#{attribute_name}_translation.#{attribute_value}")
|
19
19
|
end
|
20
20
|
else
|
21
21
|
self.send(:define_method, "#{attribute_name}_translated") do
|
22
22
|
attribute_value = self.send(attribute_name)
|
23
|
-
I18n.t("translated_attribute_value
|
23
|
+
I18n.t("translated_attribute_value.user.#{attribute_name}_translation.#{attribute_value}")
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -5,9 +5,6 @@ describe TranslatedAttributeValue::Base do
|
|
5
5
|
let(:test_model) { Class.new do
|
6
6
|
include TranslatedAttributeValue::Base
|
7
7
|
translated_value_for :status
|
8
|
-
def self.to_s
|
9
|
-
"nome_classe"
|
10
|
-
end
|
11
8
|
end.new
|
12
9
|
}
|
13
10
|
|
@@ -24,7 +21,7 @@ describe TranslatedAttributeValue::Base do
|
|
24
21
|
|
25
22
|
specify do
|
26
23
|
test_model.stub(:status).and_return('my_value')
|
27
|
-
expect(I18n).to receive(:t).with("activerecord.attributes.
|
24
|
+
expect(I18n).to receive(:t).with("activerecord.attributes.user.status_translation.my_value")
|
28
25
|
test_model.status_translated
|
29
26
|
end
|
30
27
|
|
@@ -37,7 +34,7 @@ describe TranslatedAttributeValue::Base do
|
|
37
34
|
|
38
35
|
specify do
|
39
36
|
test_model.stub(:status).and_return('my_value')
|
40
|
-
expect(I18n).to receive(:t).with("mongoid.attributes.
|
37
|
+
expect(I18n).to receive(:t).with("mongoid.attributes.user.status_translation.my_value")
|
41
38
|
test_model.status_translated
|
42
39
|
end
|
43
40
|
|
@@ -49,7 +46,7 @@ describe TranslatedAttributeValue::Base do
|
|
49
46
|
|
50
47
|
specify do
|
51
48
|
test_model.stub(:status).and_return('my_value')
|
52
|
-
expect(I18n).to receive(:t).with("translated_attribute_value.
|
49
|
+
expect(I18n).to receive(:t).with("translated_attribute_value.user.status_translation.my_value")
|
53
50
|
test_model.status_translated
|
54
51
|
end
|
55
52
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: translated_attribute_value
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vinícius Oyama
|
@@ -53,9 +53,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
53
|
version: '0'
|
54
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- - "
|
56
|
+
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
58
|
+
version: '0'
|
59
59
|
requirements: []
|
60
60
|
rubyforge_project:
|
61
61
|
rubygems_version: 2.2.2
|