translated_attribute_value 0.0.1 → 0.0.2a

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: 32a73c61415386ebc9b3d3a1cf40c78e0d898371
4
- data.tar.gz: e1ab310f9b93d6a1c6217647a3aa7835e3c8b3bb
3
+ metadata.gz: 7c32c658738be1837bf07e074a6b443d2a228a3f
4
+ data.tar.gz: 3ea07b715353525b0b0f16d059939ca5eb67b831
5
5
  SHA512:
6
- metadata.gz: f0983d7ff7328f60e892ef8f9e0822965e5c8c06f1f933cf9c20d84f8e98772dad73cc2a2bd2adf9881ea5c3b25fdd1505211f908cef452da39c77b514842d19
7
- data.tar.gz: c321d7e4c0390754c844de31494b234ad92f168c55b695fd969a6600fb358d1bd8e225c659ec9b2c9607d8fe720e8e3051abf68f759b287a66a452408de2e256
6
+ metadata.gz: 43da2e271c530a3d4d6f5e74afc34fcab5c326f8769f6930de1e886cbef93d73fdb5f42f9a5573eb6d76c57973d17e91b4cbb7562e5f3c15d68416a64deb0fc5
7
+ data.tar.gz: deaa6468e42e1bfb9313c54f1136f3c8c1c0f6131feeb7ba7cb5c00f004610c8b0720f24a94dc98e463cba6f510e52feb48891bd89711e30a260cd4323251bbc
data/README.md CHANGED
@@ -3,7 +3,7 @@ In your model (activerecord or mongo):
3
3
 
4
4
  ```ruby
5
5
  class User
6
- include NamespacedAssetsRails::Base
6
+ include TranslatedAttributeValue::Base
7
7
 
8
8
  # if you have a field called status
9
9
  translate_value_for :status
@@ -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.user.status_translation.#{attribute_name}.#{attribute_value}")
13
+ I18n.t("activerecord.attributes.#{self.class.to_s.downcase}.#{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.user.status_translation.#{attribute_name}.#{attribute_value}")
18
+ I18n.t("mongoid.attributes.#{self.class.to_s.downcase}.#{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.user.status_translation.#{attribute_name}.#{attribute_value}")
23
+ I18n.t("translated_attribute_value.#{self.class.to_s.downcase}.#{attribute_name}_translation.#{attribute_value}")
24
24
  end
25
25
  end
26
26
  end
@@ -1,3 +1,3 @@
1
1
  module TranslatedAttributeValue
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2a"
3
3
  end
@@ -5,6 +5,9 @@ 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
8
11
  end.new
9
12
  }
10
13
 
@@ -21,7 +24,7 @@ describe TranslatedAttributeValue::Base do
21
24
 
22
25
  specify do
23
26
  test_model.stub(:status).and_return('my_value')
24
- expect(I18n).to receive(:t).with("activerecord.attributes.user.status_translation.status.my_value")
27
+ expect(I18n).to receive(:t).with("activerecord.attributes.nome_classe.status_translation.my_value")
25
28
  test_model.status_translated
26
29
  end
27
30
 
@@ -34,7 +37,7 @@ describe TranslatedAttributeValue::Base do
34
37
 
35
38
  specify do
36
39
  test_model.stub(:status).and_return('my_value')
37
- expect(I18n).to receive(:t).with("mongoid.attributes.user.status_translation.status.my_value")
40
+ expect(I18n).to receive(:t).with("mongoid.attributes.nome_classe.status_translation.my_value")
38
41
  test_model.status_translated
39
42
  end
40
43
 
@@ -46,7 +49,7 @@ describe TranslatedAttributeValue::Base do
46
49
 
47
50
  specify do
48
51
  test_model.stub(:status).and_return('my_value')
49
- expect(I18n).to receive(:t).with("translated_attribute_value.user.status_translation.status.my_value")
52
+ expect(I18n).to receive(:t).with("translated_attribute_value.nome_classe.status_translation.my_value")
50
53
  test_model.status_translated
51
54
  end
52
55
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translated_attribute_value
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2a
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinícius Oyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-28 00:00:00.000000000 Z
11
+ date: 2014-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -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: '0'
58
+ version: 1.3.1
59
59
  requirements: []
60
60
  rubyforge_project:
61
61
  rubygems_version: 2.2.2