lib/model_discovery/discovery.rb in model_discovery-0.3.5 vs lib/model_discovery/discovery.rb in model_discovery-0.3.6
- old
+ new
@@ -6,13 +6,13 @@
all_gems = Bundler.require()
# 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: #{gem.name}"
- spec = Gem::Specification.find_by_name gem.name
- discover spec.gem_dir
+ puts "Gem name: \t#{gem.name}"
+ spec = Gem::Specification.find_all_by_name gem.name
+ discover spec.first.gem_dir
end
end
# Discover models in current rails app and load them
discover Rails.root
@@ -41,10 +41,10 @@
end
end
def self.discover(path)
Dir["#{path}/app/models/**/*.rb"].each do |model_file|
- puts "File matched: #{model_file}"
+ puts "File matched: \t#{model_file}"
begin
load model_file
rescue ActiveSupport::Concern::MultipleIncludedBlocks => e
puts "[Ignored]: ActiveSupport::Concern::MultipleIncludedBlocks on #{model_file}"
end