sidenotes 0.1.1 → 0.1.2
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 +4 -4
- data/lib/sidenotes/generator.rb +2 -13
- data/lib/sidenotes/model_inspector.rb +3 -1
- data/lib/sidenotes/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b8ae9eac3b04b22f97ed8449628befa33a88bfa94ac1e3533a62290ffffb1a32
|
|
4
|
+
data.tar.gz: 81616ba19442a2b9dbae04a494d092cd93f998aaf5fb2a105f75a0fbfb059b16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 668ef3a9a5bbdb367fce80df121953c503f8ac4f948ba246eb1cf297ad620adba89e8e9e97a9a4bf8bb8d518f052fd4a6cbb79090099a1e8541f2ab19cce6a14
|
|
7
|
+
data.tar.gz: 5bad7f9f8f5f6673938f93e85711d7782b0abe180c49e4f7ba3d14047f729bd868b7e095ee1263c663d83ff728d6eed0f936b933cefd1ea03145c1bcf58f6ebb
|
data/lib/sidenotes/generator.rb
CHANGED
|
@@ -70,20 +70,9 @@ module Sidenotes
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def load_model_files
|
|
73
|
-
return
|
|
73
|
+
return unless defined?(Rails) && Rails.application
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
require file
|
|
77
|
-
rescue LoadError, NameError => e
|
|
78
|
-
warn "Sidenotes: could not load #{file}: #{e.message}"
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def model_file_paths
|
|
83
|
-
Sidenotes.configuration.model_paths.flat_map do |path|
|
|
84
|
-
full_path = defined?(Rails) ? Rails.root.join(path) : Pathname.new(path)
|
|
85
|
-
Dir.glob(full_path.join('**', '*.rb'))
|
|
86
|
-
end
|
|
75
|
+
Rails.application.eager_load!
|
|
87
76
|
end
|
|
88
77
|
|
|
89
78
|
def collect_models
|
|
@@ -108,7 +108,7 @@ module Sidenotes
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
def associations
|
|
111
|
-
model.reflect_on_all_associations.
|
|
111
|
+
model.reflect_on_all_associations.filter_map { |assoc| build_association_data(assoc) }
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
def build_association_data(assoc)
|
|
@@ -119,6 +119,8 @@ module Sidenotes
|
|
|
119
119
|
data['polymorphic'] = true if opts[:polymorphic]
|
|
120
120
|
data['through'] = opts[:through].to_s if opts[:through]
|
|
121
121
|
data
|
|
122
|
+
rescue NoMethodError
|
|
123
|
+
nil
|
|
122
124
|
end
|
|
123
125
|
|
|
124
126
|
def foreign_keys
|
data/lib/sidenotes/version.rb
CHANGED