forest_liana 1.4.5 → 1.4.6
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6dac4da1a71a663bfdd2f36870f8e5ccbc150b03
|
|
4
|
+
data.tar.gz: ffc0af068f5056eaa86920ca86dcdc3097509d85
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 06f4028b47406055fec5ff180cc966fafdef44b8b3dfbc1e756cf85a716647852e85db519480582d20d919ca98029d607b67de7acd2bfa7bbb9866bb565e9cb5
|
|
7
|
+
data.tar.gz: ea027353665909b1c751896a84ccd0e96db8e0b97c4d5cf35a21c5f9bfe775adc3deb0c879a0e8d909e9912e32543acbe523c25d01a58d19ff271a740a0401c0
|
|
@@ -30,7 +30,7 @@ module ForestLiana
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def extract_attributes_serialize
|
|
33
|
-
|
|
33
|
+
attributes_serialized.each do |attribute, serializer|
|
|
34
34
|
value = @params[:data][:attributes][attribute]
|
|
35
35
|
@attributes[attribute] = JSON::parse(value)
|
|
36
36
|
end
|
|
@@ -123,6 +123,17 @@ module ForestLiana
|
|
|
123
123
|
@resource.columns.find { |column| column.name == attribute }.present?
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
+
def attributes_serialized
|
|
127
|
+
if Rails::VERSION::MAJOR >= 5
|
|
128
|
+
@attributes.select do |attribute|
|
|
129
|
+
@resource.type_for_attribute(attribute).class ==
|
|
130
|
+
::ActiveRecord::Type::Serialized
|
|
131
|
+
end
|
|
132
|
+
else
|
|
133
|
+
@resource.serialized_attributes
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
126
137
|
def carrierwave_attribute?(attr)
|
|
127
138
|
@resource.uploaders.include?(attr.try(:to_sym))
|
|
128
139
|
end
|
|
@@ -168,7 +168,7 @@ module ForestLiana
|
|
|
168
168
|
end
|
|
169
169
|
|
|
170
170
|
# NOTICE: Format serialized fields.
|
|
171
|
-
active_record_class.
|
|
171
|
+
attributes_serialized(active_record_class).each do |attribute, serialization|
|
|
172
172
|
serializer.attribute(attribute) do |x|
|
|
173
173
|
value = object.send(attribute)
|
|
174
174
|
value ? value.to_json : nil
|
|
@@ -299,6 +299,17 @@ module ForestLiana
|
|
|
299
299
|
end
|
|
300
300
|
end
|
|
301
301
|
|
|
302
|
+
def attributes_serialized(active_record_class)
|
|
303
|
+
if Rails::VERSION::MAJOR >= 5
|
|
304
|
+
attributes(active_record_class).select do |attribute|
|
|
305
|
+
active_record_class.type_for_attribute(attribute).class ==
|
|
306
|
+
::ActiveRecord::Type::Serialized
|
|
307
|
+
end
|
|
308
|
+
else
|
|
309
|
+
active_record_class.serialized_attributes
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
|
|
302
313
|
def association?(active_record_class, column_name)
|
|
303
314
|
foreign_keys(active_record_class).include?(column_name)
|
|
304
315
|
end
|
data/lib/forest_liana/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_liana
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sandro Munda
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-11-
|
|
11
|
+
date: 2016-11-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|