active_record_schema_scrapper 0.1.1 → 0.1.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: fd1b57d1f85ff5c858486752ed97ff2a83800ffc
|
4
|
+
data.tar.gz: b80d941344f8bc4a7821b876dfbf9ec634504c9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 074306e429e870119dda643b8dd915ec370413ec4df0100a43d5546e0aa75502beac48213d6a8dd6180836e7e0ddbe69449184f2317d8a50541ef60a15416a47
|
7
|
+
data.tar.gz: a3da99ad3a1a02677a5dd680a57704548a0a09d71beb21b2165fd727a576ee4a89322bd1a06c25832a1d2c7e10961c61d888e3d60654f31a61ef6c113d709151
|
@@ -21,16 +21,16 @@ class ActiveRecordSchemaScrapper
|
|
21
21
|
{ source: a.try(:delegate_reflection).try(:name),
|
22
22
|
through: a.try(:through),
|
23
23
|
dependent: a.options[:dependent] }
|
24
|
-
end.merge(
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
type: type,
|
29
|
-
})
|
24
|
+
end.merge(name: a.name,
|
25
|
+
foreign_key: a.foreign_key,
|
26
|
+
class_name: a.klass.name,
|
27
|
+
type: type)
|
30
28
|
|
31
29
|
yield(ActiveRecordSchemaScrapper::Association.new(hash))
|
32
30
|
rescue NameError => e
|
33
|
-
errors <<
|
31
|
+
errors << OpenStruct.new(class_name: model.name,
|
32
|
+
message: "Missing model #{a.name.to_s.camelize} for association #{model.name}.belongs_to :#{a.name}",
|
33
|
+
original_error: e)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -2,7 +2,8 @@ class ActiveRecordSchemaScrapper
|
|
2
2
|
class Attributes
|
3
3
|
|
4
4
|
def initialize(model:)
|
5
|
-
@model
|
5
|
+
@model = model
|
6
|
+
@errors = []
|
6
7
|
end
|
7
8
|
|
8
9
|
include Enumerable
|
@@ -31,6 +32,8 @@ class ActiveRecordSchemaScrapper
|
|
31
32
|
@registered_defaults ||= []
|
32
33
|
end
|
33
34
|
|
35
|
+
attr_reader :errors
|
36
|
+
|
34
37
|
private
|
35
38
|
|
36
39
|
attr_reader :model
|
@@ -47,6 +50,10 @@ class ActiveRecordSchemaScrapper
|
|
47
50
|
null: v.null,
|
48
51
|
)
|
49
52
|
end
|
53
|
+
rescue NoMethodError => e
|
54
|
+
@errors << OpenStruct.new(class_name: model.name,
|
55
|
+
message: "#{model.name} is not a valid ActiveRecord model.",
|
56
|
+
original_error: e)
|
50
57
|
end
|
51
58
|
end
|
52
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_schema_scrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Zeisler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|