lolita-translation 0.7.1 → 0.7.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: 0d13f0b3c8ae3cfd3e2464773538a6ab3f21552a
|
4
|
+
data.tar.gz: 171b142817fef43c89ee2e274306e7dbe35feb19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71da84d89a2c4a43c5c7cefa609a66a72927f4e8edcdfb15350b7d469e413904c906995cea85a883aa3a3badac4076df843b94ad6f04fafe40266ab4fa8a1167
|
7
|
+
data.tar.gz: 722fd8ac3412b58df090a2f5087e1af4ea61dbe06a0179ae46cbf255d6470e306ec9a26c1695d64246ec2de842c986e4bd6e43d1f2a58117527c0f7248ab9ebc
|
@@ -36,11 +36,21 @@ module Lolita
|
|
36
36
|
def add_ar_klass_attr_accessible attributes
|
37
37
|
ar_translation_builder = self
|
38
38
|
klass.class_eval do
|
39
|
-
|
39
|
+
if ar_translation_builder.send(:attr_accessible_required?, ar_translation_builder.base_klass)
|
40
|
+
attr_accessible :locale, *attributes
|
41
|
+
end
|
40
42
|
self.table_name = ar_translation_builder.table_name
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
46
|
+
def attr_accessible_required? klass
|
47
|
+
if defined?(ActiveModel::ForbiddenAttributesProtection)
|
48
|
+
!klass.ancestors.include?(ActiveModel::ForbiddenAttributesProtection)
|
49
|
+
else
|
50
|
+
true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
44
54
|
def add_ar_klass_table_name name
|
45
55
|
klass.class_eval do
|
46
56
|
self.table_name = name
|
@@ -79,7 +89,9 @@ module Lolita
|
|
79
89
|
:dependent => :destroy
|
80
90
|
})
|
81
91
|
base_klass.accepts_nested_attributes_for translations_association_name, :allow_destroy => true, :reject_if => nested_attributes_rejection_proc
|
82
|
-
base_klass
|
92
|
+
if attr_accessible_required? base_klass
|
93
|
+
base_klass.attr_accessible :translations_attributes, locale_field_name
|
94
|
+
end
|
83
95
|
end
|
84
96
|
end
|
85
97
|
|