lib/rails_erd/tasks.rake in rails-erd-0.4.4 vs lib/rails_erd/tasks.rake in rails-erd-0.4.5

- old
+ new

@@ -17,10 +17,20 @@ task :load_models do say "Loading application environment..." Rake::Task[:environment].invoke say "Loading code in search of Active Record models..." - Rails.application.eager_load! + begin + Rails.application.eager_load! + rescue Exception => err + if Rake.application.options.trace + raise + else + trace = Rails.backtrace_cleaner.clean(err.backtrace) + error = (["Loading models failed!\nError occurred while loading application: #{err} (#{err.class})"] + trace).join("\n ") + raise error + end + end raise "Active Record was not loaded." unless defined? ActiveRecord end task :generate => [:options, :load_models] do