dynamic-active-model 0.7.2 → 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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df4da0b0a5a5026754e0624dd508604ac4796ac3f60f37fa82018691fa596f3f
|
|
4
|
+
data.tar.gz: d42ea5435c3ad98e7bb6e9c4489df62db14b7b6199df3e0247989ad7b8a6a725
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 986938faee17bc087e8260f468bf6c346244e291527c0f827b0ce0e227d079b22c082848eadb202a93d51798124787e496f343c9c4221eec0db652b3d3cb8218
|
|
7
|
+
data.tar.gz: f0d2af7a8da7d120dc82b3600ed8b3daef0a5d0eb7c581a2fc60dbc205b0440cb27cf01d792ffb0aeaa481756db5d63e603e2548ea3e5153b007c6ebffdce4b8
|
|
@@ -153,7 +153,7 @@ module DynamicActiveModel
|
|
|
153
153
|
if file
|
|
154
154
|
updater = ModelUpdater.new(model)
|
|
155
155
|
ctx = updater.instance_eval { binding }
|
|
156
|
-
eval(File.read(file), ctx, file, 1)
|
|
156
|
+
eval(File.read(file), ctx, file, 1) # rubocop:disable Security/Eval -- extension files are trusted code
|
|
157
157
|
end
|
|
158
158
|
model.class_eval(&block) if block
|
|
159
159
|
model
|
|
@@ -62,33 +62,25 @@ module DynamicActiveModel
|
|
|
62
62
|
# Gets all has_many relationships for the model
|
|
63
63
|
# @return [Array<ActiveRecord::Reflection::HasManyReflection>]
|
|
64
64
|
def all_has_many_relationships
|
|
65
|
-
@model.reflect_on_all_associations.
|
|
66
|
-
assoc.is_a?(ActiveRecord::Reflection::HasManyReflection)
|
|
67
|
-
end
|
|
65
|
+
@model.reflect_on_all_associations.grep(ActiveRecord::Reflection::HasManyReflection)
|
|
68
66
|
end
|
|
69
67
|
|
|
70
68
|
# Gets all belongs_to relationships for the model
|
|
71
69
|
# @return [Array<ActiveRecord::Reflection::BelongsToReflection>]
|
|
72
70
|
def all_belongs_to_relationships
|
|
73
|
-
@model.reflect_on_all_associations.
|
|
74
|
-
assoc.is_a?(ActiveRecord::Reflection::BelongsToReflection)
|
|
75
|
-
end
|
|
71
|
+
@model.reflect_on_all_associations.grep(ActiveRecord::Reflection::BelongsToReflection)
|
|
76
72
|
end
|
|
77
73
|
|
|
78
74
|
# Gets all has_one relationships for the model
|
|
79
75
|
# @return [Array<ActiveRecord::Reflection::HasOneReflection>]
|
|
80
76
|
def all_has_one_relationships
|
|
81
|
-
@model.reflect_on_all_associations.
|
|
82
|
-
assoc.is_a?(ActiveRecord::Reflection::HasOneReflection)
|
|
83
|
-
end
|
|
77
|
+
@model.reflect_on_all_associations.grep(ActiveRecord::Reflection::HasOneReflection)
|
|
84
78
|
end
|
|
85
79
|
|
|
86
80
|
# Gets all has_and_belongs_to_many relationships for the model
|
|
87
81
|
# @return [Array<ActiveRecord::Reflection::HasAndBelongsToManyReflection>]
|
|
88
82
|
def all_has_and_belongs_to_many_relationships
|
|
89
|
-
@model.reflect_on_all_associations.
|
|
90
|
-
assoc.is_a?(ActiveRecord::Reflection::HasAndBelongsToManyReflection)
|
|
91
|
-
end
|
|
83
|
+
@model.reflect_on_all_associations.grep(ActiveRecord::Reflection::HasAndBelongsToManyReflection)
|
|
92
84
|
end
|
|
93
85
|
|
|
94
86
|
# Appends an association definition to the source string
|
data/lib/dynamic-active-model.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dynamic-active-model
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Doug Youch
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activerecord
|
|
@@ -58,6 +58,7 @@ files:
|
|
|
58
58
|
- lib/dynamic-active-model/foreign_key.rb
|
|
59
59
|
- lib/dynamic-active-model/setup.rb
|
|
60
60
|
- lib/dynamic-active-model/template_class_file.rb
|
|
61
|
+
- lib/dynamic-active-model/version.rb
|
|
61
62
|
homepage: https://github.com/dougyouch/dynamic-active-model
|
|
62
63
|
licenses:
|
|
63
64
|
- MIT
|
|
@@ -77,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
77
78
|
- !ruby/object:Gem::Version
|
|
78
79
|
version: '0'
|
|
79
80
|
requirements: []
|
|
80
|
-
rubygems_version:
|
|
81
|
+
rubygems_version: 4.0.20
|
|
81
82
|
specification_version: 4
|
|
82
83
|
summary: Automatically discover database schemas and create ActiveRecord models with
|
|
83
84
|
relationships
|