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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fcfac7d0453a36d522a8e8b82ad334e6fc1ae14135515cd64fa01950f82dc7b
4
- data.tar.gz: ce7f6fd534eb07b6179c6c94017925a71058b56870b3f9cd68080701b1b6d9d6
3
+ metadata.gz: b8ae9eac3b04b22f97ed8449628befa33a88bfa94ac1e3533a62290ffffb1a32
4
+ data.tar.gz: 81616ba19442a2b9dbae04a494d092cd93f998aaf5fb2a105f75a0fbfb059b16
5
5
  SHA512:
6
- metadata.gz: a41114cdec1f8a734ca78571c57032fe69115e4e2dac993c3bef91cd7335f49fabedfc8ad2bc83e81bfa36b7f4b67e47f44df152682e7a36d566af49968c220d
7
- data.tar.gz: 52255ffa8e27616bd0e83ca2f59c881d4273cc0515c0d4c17f9c2095bb663a86804ce280c415235d450ade1e96e51ac58ed7ea12af4533ea0044f9830dadd0b6
6
+ metadata.gz: 668ef3a9a5bbdb367fce80df121953c503f8ac4f948ba246eb1cf297ad620adba89e8e9e97a9a4bf8bb8d518f052fd4a6cbb79090099a1e8541f2ab19cce6a14
7
+ data.tar.gz: 5bad7f9f8f5f6673938f93e85711d7782b0abe180c49e4f7ba3d14047f729bd868b7e095ee1263c663d83ff728d6eed0f936b933cefd1ea03145c1bcf58f6ebb
@@ -70,20 +70,9 @@ module Sidenotes
70
70
  end
71
71
 
72
72
  def load_model_files
73
- return if defined?(Rails) && Rails.application&.config&.eager_load
73
+ return unless defined?(Rails) && Rails.application
74
74
 
75
- model_file_paths.each do |file|
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.map { |assoc| build_association_data(assoc) }
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sidenotes
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidenotes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wes Mason