globalize-accessors 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/globalize-accessors.gemspec +1 -1
- data/lib/globalize-accessors.rb +1 -0
- data/lib/globalize-accessors/version.rb +1 -1
- data/readme.md +1 -1
- data/test/globalize_accessors_test.rb +9 -0
- metadata +6 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b24dfdcadad659639d275ef9598edd54b74623afcddc067bb3539b9379516d50
|
4
|
+
data.tar.gz: b6f234105d5bc9911feba08771b05dd82cd796fc1d767234aec5d1982a0a059b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94a313445016b3967875ac18778e52f80c344936914fe4bbef3083c2e8d596be7013f9ff55c520079ad78351ed445671ca427060957255bab4531cdc0eafd7e0
|
7
|
+
data.tar.gz: ad260c54dd05b22081f6c3ac42588c73f634952beeda208f6534584133d07d3b8f686112fd69fb2af68b5c6d401c908858628bf5b58a295baa89a64bfa07fe9d
|
data/globalize-accessors.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.required_rubygems_version = ">= 1.3"
|
15
15
|
s.rubyforge_project = "globalize-accessors"
|
16
16
|
|
17
|
-
s.add_dependency "globalize",
|
17
|
+
s.add_dependency "globalize", ">= 5.0.0"
|
18
18
|
|
19
19
|
s.add_development_dependency "sqlite3"
|
20
20
|
s.add_development_dependency "rake"
|
data/lib/globalize-accessors.rb
CHANGED
@@ -36,6 +36,7 @@ module Globalize::Accessors
|
|
36
36
|
localized_attr_name = localized_attr_name_for(attr_name, locale)
|
37
37
|
|
38
38
|
define_method :"#{localized_attr_name}=" do |value|
|
39
|
+
attribute_will_change!(localized_attr_name) if value != send(localized_attr_name)
|
39
40
|
write_attribute(attr_name, value, :locale => locale)
|
40
41
|
translation_for(locale)[attr_name] = value
|
41
42
|
end
|
data/readme.md
CHANGED
@@ -70,7 +70,7 @@ If you wish to always define accessors and don't want to call the `globalize_acc
|
|
70
70
|
module TranslatesWithAccessors
|
71
71
|
|
72
72
|
def translates(*params)
|
73
|
-
options = params.extract_options!
|
73
|
+
options = params.dup.extract_options!
|
74
74
|
options.reverse_merge!(:globalize_accessors => true)
|
75
75
|
accessors = options.delete(:globalize_accessors)
|
76
76
|
super
|
@@ -187,4 +187,13 @@ class GlobalizeAccessorsTest < ActiveSupport::TestCase
|
|
187
187
|
test "instance without accessors" do
|
188
188
|
refute UnitWithoutAccessors.new.respond_to?(:localized_attr_name_for)
|
189
189
|
end
|
190
|
+
|
191
|
+
test "dirty checking" do
|
192
|
+
u = Unit.create!(:name_en => "Name en")
|
193
|
+
u.name_en = "New name en"
|
194
|
+
assert u.changed.include?("name_en")
|
195
|
+
assert ["Name en", "New name en"], u.changes["name_en"]
|
196
|
+
u.save!
|
197
|
+
assert ! u.changed.include?("name_en")
|
198
|
+
end
|
190
199
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: globalize-accessors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Stachewicz
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
- Steve Verlinden
|
10
10
|
- Robert Pankowecki
|
11
11
|
- Chris Salzberg
|
12
|
-
autorequire:
|
12
|
+
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2021-01-25 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: globalize
|
@@ -21,9 +21,6 @@ dependencies:
|
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 5.0.0
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '5.0'
|
27
24
|
type: :runtime
|
28
25
|
prerelease: false
|
29
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -31,9 +28,6 @@ dependencies:
|
|
31
28
|
- - ">="
|
32
29
|
- !ruby/object:Gem::Version
|
33
30
|
version: 5.0.0
|
34
|
-
- - "~>"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '5.0'
|
37
31
|
- !ruby/object:Gem::Dependency
|
38
32
|
name: sqlite3
|
39
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,7 +98,7 @@ files:
|
|
104
98
|
homepage: http://rubygems.org/gems/globalize-accessors
|
105
99
|
licenses: []
|
106
100
|
metadata: {}
|
107
|
-
post_install_message:
|
101
|
+
post_install_message:
|
108
102
|
rdoc_options: []
|
109
103
|
require_paths:
|
110
104
|
- lib
|
@@ -119,10 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
113
|
- !ruby/object:Gem::Version
|
120
114
|
version: '1.3'
|
121
115
|
requirements: []
|
122
|
-
|
123
|
-
|
124
|
-
signing_key:
|
116
|
+
rubygems_version: 3.2.3
|
117
|
+
signing_key:
|
125
118
|
specification_version: 4
|
126
119
|
summary: Define methods for accessing translated attributes
|
127
120
|
test_files: []
|
128
|
-
has_rdoc:
|