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: eacac6197ace9e935ccd39162554799972f60d55
4
- data.tar.gz: 05a8129d30433e5ac38c22adcfa4abf5a5b980bc
3
+ metadata.gz: 0d13f0b3c8ae3cfd3e2464773538a6ab3f21552a
4
+ data.tar.gz: 171b142817fef43c89ee2e274306e7dbe35feb19
5
5
  SHA512:
6
- metadata.gz: 078b5e8431713ed62eaefbe7495963ff9637a72e5c990b3c3a14631a4de49a0137eec45add6f43b153b75ae9a5be0d1a34c4ebc8a3bccb8a695816ee9c95c024
7
- data.tar.gz: 31cb44081b8aa06e8ca46afe54d677bda2c234276d71da8726759726bb65b70a14cc26efe6ac430d43347dff761ffaa668d7a25e3f78c73c0d7e91e6a1a43fbe
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
- attr_accessible :locale, *attributes
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.attr_accessible :translations_attributes, locale_field_name
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
 
@@ -3,7 +3,7 @@ module Lolita
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 7
6
- PATCH = 1
6
+ PATCH = 2
7
7
  BUILD = nil
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolita-translation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ITHouse (Latvia) and Arturs Meisters