Commit 5e3820b8 by Hitabis GmbH Committed by Cuong Tran

annotate --routes modifies only routes.rb (#485)

* annotate --routes modifies only routes.rb This change is a proposed solution to #357 and an alternative to the already proposed solution #361. In #361 it is needed to call `annotate --routes --ignore-models` to achieve the same as in this change with only `annotate --routes`. * Call eager_load only when models are included This to prevent activerecord model errors when using mongoid for example and calling `annotate --routes`
parent 330f8bdb
......@@ -202,7 +202,7 @@ end.parse!
options = Annotate.setup_options(
is_rake: ENV['is_rake'] && !ENV['is_rake'].empty?
)
Annotate.eager_load(options)
Annotate.eager_load(options) if Annotate.include_models?
AnnotateModels.send(target_action, options) if Annotate.include_models?
AnnotateRoutes.send(target_action, options) if Annotate.include_routes?
......@@ -114,7 +114,7 @@ module Annotate
end
def self.include_models?
true
ENV['routes'] !~ TRUE_RE
end
def self.loaded_tasks=(val)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment