custom_fielder 0.7.9 → 0.8.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/app/models/custom_fielder/value.rb +51 -0
- data/lib/custom_fielder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c547cb274a34d4c8cd3ea3eaf2973291178a976
|
4
|
+
data.tar.gz: 0730ecc83fef7696da69d2adc90dd7d11015fe17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fd40c8770d9d718ef861122023ff6b1297f972fbcd2a72246425e875e794457c42bc2de722a80d914ce723d13799a18be5ca220fb4cdff269043898005480f4
|
7
|
+
data.tar.gz: 90fb1cbcdc87ae1074bc6daaf765ee760283c041ad19b05c13c410d6884ae77a5646f2e8d69d317ba022479b3990cf46e665163a067373962a754ef29d970274
|
@@ -25,6 +25,57 @@ module CustomFielder
|
|
25
25
|
def value; super; end
|
26
26
|
alias_method :raw_value, :value
|
27
27
|
def value; deserialize_value; end;
|
28
|
+
|
29
|
+
##
|
30
|
+
# Allows for the creation of many values at one time
|
31
|
+
# this will return an array where the first element is
|
32
|
+
# a boolean whose value corresponds to whether or not there
|
33
|
+
# were any errors, the second value is the array of values
|
34
|
+
# that were created
|
35
|
+
#
|
36
|
+
# @param values [Array]
|
37
|
+
# @return [Array<Boolean,Array<Value>>]
|
38
|
+
#
|
39
|
+
def self.create_many(values)
|
40
|
+
errors, values = false, transaction { create!(values) }
|
41
|
+
values.each { |v| errors = true if v.errors.any? }
|
42
|
+
|
43
|
+
[errors, values]
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Allows for updating many value records at one time
|
48
|
+
# this will return an array where the first element is
|
49
|
+
# a boolean whose value corresponds to whether or not there
|
50
|
+
# were any errors, the second value is the array of values
|
51
|
+
# that were updated
|
52
|
+
#
|
53
|
+
# @param values [Array]
|
54
|
+
# @return [Array<Boolean,Array<Value>>]
|
55
|
+
#
|
56
|
+
def self.update_many(values)
|
57
|
+
errors, values = false, transaction { update!(values) }
|
58
|
+
values.each { |v| errors = true if v.errors.any? }
|
59
|
+
|
60
|
+
[errors, values]
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Allows for the deletion of many values at one time
|
65
|
+
# this will return an array where the first element is a
|
66
|
+
# boolean whose value corresponds to whether or not there
|
67
|
+
# were any errors, the second value is the array of values
|
68
|
+
# that were deleted
|
69
|
+
#
|
70
|
+
# @param ids [Array]
|
71
|
+
# @return [Array<Boolean,Array<Value>>]
|
72
|
+
#
|
73
|
+
def self.delete_many(ids)
|
74
|
+
errors, values = false, transaction { where(id: ids).destroy_all }
|
75
|
+
values.each { |v| errors = true if v.errors.any? }
|
76
|
+
|
77
|
+
[errors, values]
|
78
|
+
end
|
28
79
|
|
29
80
|
private
|
30
81
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: custom_fielder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Hurst
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|