acts_as_localized 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/acts_as_localized.rb +3 -0
- data/lib/acts_as_localized/version.rb +1 -1
- data/test/acts_as_localized_test.rb +21 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03d61b9843674dc73d603215b8595f16c34cef00
|
4
|
+
data.tar.gz: ceb2d206e9c899cfbcf188004a43bd8708d1ae85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee7b554bba7285bc51eab0d366c176e9e1e561c6e773b8b5283293a0f8fe53af05a0d4d4e9127fd96f1ebde4ef35cee337d609845cbc22373e86f8ea61ca9a98
|
7
|
+
data.tar.gz: d3c8acc428ecf1cd1f775b3bc8f678b1c9d75ab693cafcc6c70fa2ca833a2dda62f4a137dd22ba4c1d8ac69fb2e7bbc7da3fe849991aa45e35cc231843a6d513
|
data/README.md
CHANGED
@@ -25,9 +25,12 @@ picture = Picture.create!(
|
|
25
25
|
)
|
26
26
|
|
27
27
|
I18n.locale = :en
|
28
|
-
picture.title
|
28
|
+
picture.title #=> Title EN
|
29
|
+
picture.title = 'Updated Title EN' # same as `picture.title_en=`
|
30
|
+
|
29
31
|
I18n.locale = :fr
|
30
32
|
picture.title # => Title FR
|
33
|
+
picture.title = 'Updated Title EN' # same as `picture.title_fr=`
|
31
34
|
```
|
32
35
|
|
33
36
|
---
|
data/lib/acts_as_localized.rb
CHANGED
@@ -50,7 +50,7 @@ class ActsAsLocalizedTest < MiniTest::Test
|
|
50
50
|
teardown_db
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
53
|
+
def test_reader
|
54
54
|
model = TestModel.create!(
|
55
55
|
:attr_en => 'content EN',
|
56
56
|
:attr_fr => 'content FR'
|
@@ -67,4 +67,24 @@ class ActsAsLocalizedTest < MiniTest::Test
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
def test_writer
|
71
|
+
model = TestModel.create!(
|
72
|
+
:attr => 'content EN'
|
73
|
+
)
|
74
|
+
assert_equal 'content EN', model.attr
|
75
|
+
assert_equal 'content EN', model.attr_en
|
76
|
+
assert_equal nil, model.attr_fr
|
77
|
+
|
78
|
+
I18n.locale = :fr
|
79
|
+
model.update_attribute(:attr, 'content FR')
|
80
|
+
assert_equal 'content FR', model.attr_fr
|
81
|
+
|
82
|
+
begin
|
83
|
+
I18n.locale = :invalid
|
84
|
+
model.attr = 'invalid'
|
85
|
+
rescue => e
|
86
|
+
assert e.is_a?(NoMethodError)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
70
90
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_localized
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Khabarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|