easy_translatable 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/translatable/active_record/instance_methods.rb +2 -15
- data/lib/translatable/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff59051dd5f5534569166f4b31b9ee93a7a637cd
|
4
|
+
data.tar.gz: 72c756caaca02663bc0fe02d61145b568f24324d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c603dbf48910d7bb8502408856ad56c9f3a9c8e14d12bbb071667bf8a3c8534ef5cd7d6e6876f56da503d290964602b7266fab076396e74b969ad985f7f03b4c
|
7
|
+
data.tar.gz: e2197b3097c3aef681045e244ac0ef60a3b017e2fbbbd4a5bcfa05d5c8766f58912f15e4710143dbbfd03a86c79efd8aef31e5330b46380553e82820b46d4838
|
@@ -32,25 +32,12 @@ module Translatable
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
|
35
|
+
# Always call the super method, the attribute is translatable and we asked a translated model
|
36
36
|
def write_attribute(name, value, options = {})
|
37
37
|
if translated?(name) && translate?
|
38
38
|
options = {:locale => Translatable.locale}.merge(options)
|
39
39
|
|
40
|
-
#
|
41
|
-
# ActiveRecord::AttributeMethods::Dirty#write_attribute.
|
42
|
-
name_str = name.to_s
|
43
|
-
if attribute_changed?(name_str)
|
44
|
-
# If there's already a change, delete it if this undoes the change.
|
45
|
-
old = changed_attributes[name_str]
|
46
|
-
changed_attributes.delete(name_str) if value == old
|
47
|
-
else
|
48
|
-
# If there's not a change yet, record it.
|
49
|
-
serialized_value = read_attribute(name, options) if self.serialized_attributes.has_key?(name)
|
50
|
-
old = translatable.fetch(options[:locale], name, serialized_value)
|
51
|
-
old = old.clone if old.duplicable?
|
52
|
-
changed_attributes[name_str] = old if value != old
|
53
|
-
end
|
40
|
+
# We don't want to track any changes, but save the new value in a translation hash
|
54
41
|
|
55
42
|
translatable.write(options[:locale], name, value)
|
56
43
|
else
|
data/lib/translatable/version.rb
CHANGED