better_record 0.17.1 → 0.17.3
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5516ca5c78cbac66c48423ce253bb55cc6440b999ea672711e4f8fd404e5c2cf
|
4
|
+
data.tar.gz: e7ee572104cfd0228c2c32ae1e6d3d65661aedfa7692d02d087f18ebb236c733
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffd4a9a236a980c579039a6d4c470176af465378ed6dcd9f45c7a70c98b9c298be1828c1e11c220789c0635d5efa87a183c8f9f49138c64fd2c5df28e4ace0ef
|
7
|
+
data.tar.gz: 2d037b4e98543662ed6800cef948f3f8ed74ad3463498a743dd520f632232c3539a0d96b1ca75313a5274b75d8099bf3d9f97e3a351a8f78300b3e9106853f8b
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class CreateBetterRecordAttachmentValidations < ActiveRecord::Migration[5.2]
|
2
2
|
def change
|
3
3
|
create_table :better_record_attachment_validations do |t|
|
4
|
-
t.
|
4
|
+
t.text :name, null: false
|
5
5
|
t.references :attachment, null: false
|
6
6
|
t.boolean :ran, null: false, default: false
|
7
7
|
|
@@ -9,7 +9,5 @@ class CreateBetterRecordAttachmentValidations < ActiveRecord::Migration[5.2]
|
|
9
9
|
|
10
10
|
t.timestamps default: -> { 'NOW()' }
|
11
11
|
end
|
12
|
-
|
13
|
-
audit_table :better_record_attachment_validations
|
14
12
|
end
|
15
13
|
end
|
@@ -2,13 +2,26 @@
|
|
2
2
|
|
3
3
|
module BetterRecord
|
4
4
|
class PolymorphicOverride
|
5
|
+
@@debugging_override = nil
|
6
|
+
|
7
|
+
def self.debug=(val)
|
8
|
+
@@debugging_override = !!val
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.debug
|
12
|
+
!!@@debugging_override
|
13
|
+
end
|
14
|
+
|
5
15
|
def self.polymorphic_value(klass, options = nil)
|
6
16
|
type_val = nil
|
7
17
|
type_method = polymorphic_method(options.presence || {})
|
8
18
|
begin
|
9
19
|
type_val = klass.__send__(type_method)
|
10
20
|
rescue
|
11
|
-
puts
|
21
|
+
puts "Error in Polymorphic Value:",
|
22
|
+
type_method, klass, type_val,
|
23
|
+
$!.message, $!.backtrace if debug
|
24
|
+
|
12
25
|
if type_val == :table_name_without_schema
|
13
26
|
type_val = klass.table_name
|
14
27
|
else
|
@@ -25,7 +38,7 @@ module BetterRecord
|
|
25
38
|
def self.all_types(klass)
|
26
39
|
keys = [ :polymorphic_name, :table_name ]
|
27
40
|
keys |= [BetterRecord.default_polymorphic_method] if BetterRecord.default_polymorphic_method.present?
|
28
|
-
p keys
|
41
|
+
p "Polymorphic methods:", keys if debug
|
29
42
|
values = []
|
30
43
|
keys.each do |k|
|
31
44
|
val = nil
|
@@ -33,8 +46,10 @@ module BetterRecord
|
|
33
46
|
val = klass.__send__(k)
|
34
47
|
values << val if val.present?
|
35
48
|
rescue
|
49
|
+
p "Error in Polymorphic Method, #{k}:", $!.message, $!.backtrace if debug
|
36
50
|
end
|
37
51
|
end
|
52
|
+
p "Present Polymorphic Values:", values if debug
|
38
53
|
values
|
39
54
|
end
|
40
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sampson Crowley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|