neo4apis-activerecord 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/neo4apis/cli/activerecord.rb +28 -17
- data/neo4apis-activerecord.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60ef840a977637782af55407f5a3ef150e0dd871
|
4
|
+
data.tar.gz: 2dad3f4ba9eb9f56b07d919df2b2554670224f1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 977ecd193e5ff8c9822f8600169c5807af583a386691e62384095cd47dc02976dd99140461cc28bee46cddd5f78b0333b4486349f3fc7ee9ddc0174c35db4e5c
|
7
|
+
data.tar.gz: 907f8975ad859187956b97b33c97c27753a0cd4944db905da92a84a8ac659a6290d2817e97d5432a064c05f5a4080dae6af755d52b21421a1843d3c65e56f80b
|
@@ -24,6 +24,34 @@ module Neo4Apis
|
|
24
24
|
def tables(*models_or_table_names)
|
25
25
|
setup
|
26
26
|
|
27
|
+
import_models_or_tables(*models_or_table_names)
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'models MODELS_OR_TABLE_NAMES', 'Import specified ActiveRecord models'
|
31
|
+
def models(*models_or_table_names)
|
32
|
+
setup
|
33
|
+
|
34
|
+
import_models_or_tables(*models_or_table_names)
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'all_tables', 'Import all SQL tables'
|
38
|
+
def all_tables
|
39
|
+
setup
|
40
|
+
|
41
|
+
import_models_or_tables(*::ActiveRecord::Base.connection.tables)
|
42
|
+
end
|
43
|
+
|
44
|
+
desc 'all_models', 'Import SQL tables using defined models'
|
45
|
+
def all_models
|
46
|
+
setup
|
47
|
+
|
48
|
+
Rails.application.eager_load!
|
49
|
+
|
50
|
+
import_models_or_tables(ActiveRecord::Base.descendants)
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def import_models_or_tables(*models_or_table_names)
|
27
55
|
model_classes = models_or_table_names.map(&method(:get_model))
|
28
56
|
|
29
57
|
puts 'Importing tables: ' + model_classes.map(&:table_name).join(', ')
|
@@ -41,23 +69,6 @@ module Neo4Apis
|
|
41
69
|
end
|
42
70
|
end
|
43
71
|
|
44
|
-
desc 'models MODELS_OR_TABLE_NAMES', 'Import specified ActiveRecord models'
|
45
|
-
def models(*models_or_table_names)
|
46
|
-
tables(*models_or_table_names)
|
47
|
-
end
|
48
|
-
|
49
|
-
desc 'all_tables', 'Import all SQL tables'
|
50
|
-
def all_tables
|
51
|
-
tables(*::ActiveRecord::Base.connection.tables)
|
52
|
-
end
|
53
|
-
|
54
|
-
desc 'all_models', 'Import SQL tables using defined '
|
55
|
-
def all_models
|
56
|
-
Rails.application.eager_load!
|
57
|
-
|
58
|
-
tables(ActiveRecord::Base.descendants)
|
59
|
-
end
|
60
|
-
|
61
72
|
private
|
62
73
|
|
63
74
|
def setup
|