lib/model_discovery/discovery.rb in model_discovery-0.3.6 vs lib/model_discovery/discovery.rb in model_discovery-0.3.7

- old
+ new

@@ -1,11 +1,11 @@ module ModelDiscovery # Create a list of current rails application tables or documents def self.build_table_list(without_habtm = true) # Get all gem by requiring them - all_gems = Bundler.require() + all_gems = Bundler.load.dependencies # Discover all model files in gem files and load them all_gems.each do |gem| if gem.groups.include? Rails.env.to_sym or gem.groups.include? :default puts "Gem name: \t#{gem.name}" @@ -43,12 +43,16 @@ def self.discover(path) Dir["#{path}/app/models/**/*.rb"].each do |model_file| puts "File matched: \t#{model_file}" begin - load model_file + require model_file rescue ActiveSupport::Concern::MultipleIncludedBlocks => e puts "[Ignored]: ActiveSupport::Concern::MultipleIncludedBlocks on #{model_file}" + rescue ArgumentError => e + if e.to_s.ends_with? 'another_enum' + puts "[Ignored]: 'enum' redifination ignored." + end end end end end