Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest using config file with .rb extension #161

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ActiveRecordDoctor::Rake::Task.new do |task|
task.deps = []

# A path to your active_record_doctor configuration file.
task.config_path = ::Rails.root.join(".active_record_doctor")
task.config_path = ::Rails.root.join(".active_record_doctor.rb")
gregnavis marked this conversation as resolved.
Show resolved Hide resolved

# A Proc called right before running detectors that should ensure your Active
# Record models are preloaded and a database connection is ready.
Expand Down Expand Up @@ -111,7 +111,7 @@ If you want to use the default configuration then you don't have to do anything.
Just run `active_record_doctor` in your project directory.

If you want to customize the tool you should create a file named
`.active_record_doctor` in your project root directory with content like:
`.active_record_doctor.rb` in your project root directory with content like:

```ruby
ActiveRecordDoctor.configure do
Expand Down
4 changes: 3 additions & 1 deletion lib/tasks/active_record_doctor.rake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ ActiveRecordDoctor::Rake::Task.new do |task|
# This file is imported when active_record_doctor is being used as part of a
# Rails app so it's the right place for all Rails-specific settings.
task.deps = [:environment]
task.config_path = Rails.root.join(".active_record_doctor")

config_name = ".active_record_doctor"
task.config_path = Rails.root.join(config_name).existence || Rails.root.join("#{config_name}.rb").existence
task.setup = -> { Rails.application.eager_load! }
end