dynamic-active-model 0.2.4 → 0.2.5
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f569197049c12601385695ca20270c941c15747c35153b3380c3dabd468abbc
|
4
|
+
data.tar.gz: b92423eecc4c37a1200b93c84b2e5463bb990802fc813a80b9322228e250635e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42932815c86faacb2fb6fa51d850a9383e5e117c15933409f19d7faf509acc49e35ebdba593344f31f83767187b9d58d10e59dfd81f76943e2d873e52ef51f82
|
7
|
+
data.tar.gz: e55af049ed222177cb021b29c3997f60d1162e5fc496e9e5b352d1d188581f91cc6d69faff3e3cef91f747a9fc23ef9db2cf2d8d61dc680cb068f26a6ad53125
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module DynamicActiveModel
|
4
|
-
# DynamicActiveModel::
|
4
|
+
# DynamicActiveModel::Associations iterates over the models of a
|
5
5
|
# database and adds has_many and belongs_to based on foreign keys
|
6
|
-
class
|
6
|
+
class Associations
|
7
7
|
attr_reader :database
|
8
8
|
|
9
9
|
def initialize(database)
|
@@ -20,7 +20,7 @@ module DynamicActiveModel
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.build_relationships!(database, relationships)
|
23
|
-
relations =
|
23
|
+
relations = Associations.new(database)
|
24
24
|
relationships.each do |table_name, foreign_keys|
|
25
25
|
foreign_keys.each do |foreign_key, relationship_name|
|
26
26
|
relations.add_foreign_key(table_name, foreign_key, relationship_name)
|
data/lib/dynamic-active-model.rb
CHANGED
@@ -6,6 +6,6 @@ module DynamicActiveModel
|
|
6
6
|
autoload :Explorer, 'dynamic-active-model/explorer'
|
7
7
|
autoload :Factory, 'dynamic-active-model/factory'
|
8
8
|
autoload :ForeignKey, 'dynamic-active-model/foreign_key'
|
9
|
-
autoload :
|
9
|
+
autoload :Associations, 'dynamic-active-model/associations'
|
10
10
|
autoload :TemplateClassFile, 'dynamic-active-model/template_class_file'
|
11
11
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamic-active-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Doug Youch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -33,11 +33,11 @@ extra_rdoc_files: []
|
|
33
33
|
files:
|
34
34
|
- bin/dynamic-db-explorer
|
35
35
|
- lib/dynamic-active-model.rb
|
36
|
+
- lib/dynamic-active-model/associations.rb
|
36
37
|
- lib/dynamic-active-model/database.rb
|
37
38
|
- lib/dynamic-active-model/explorer.rb
|
38
39
|
- lib/dynamic-active-model/factory.rb
|
39
40
|
- lib/dynamic-active-model/foreign_key.rb
|
40
|
-
- lib/dynamic-active-model/relations.rb
|
41
41
|
- lib/dynamic-active-model/template_class_file.rb
|
42
42
|
homepage: https://github.com/dougyouch/dynamic-active-model
|
43
43
|
licenses: []
|