lib/model_discovery/discovery.rb in model_discovery-0.2.0 vs lib/model_discovery/discovery.rb in model_discovery-0.2.1

- old
+ new

@@ -1,14 +1,16 @@ module ModelDiscovery def self.build_table_list # Get all gem by requiring them - all_gems = Bundler.require + all_gems = Bundler.require() # Discover all model files in gem files and load them all_gems.each do |gem| - puts "Gem name: #{gem.name}" - spec = Gem::Specification.find_by_name gem.name - discover spec.gem_dir + if gem.groups.include? Rails.env.to_sym or gem.groups.include? :default + puts "Gem name: #{gem.name}" + spec = Gem::Specification.find_by_name gem.name + discover spec.gem_dir + end end # Discover models in current rails app and load them discover Rails.root