lib/sql_tracker/config.rb in sql_tracker-1.0.1 vs lib/sql_tracker/config.rb in sql_tracker-1.1.0
- old
+ new
@@ -8,10 +8,16 @@
class << self
def apply_defaults
self.enabled = enabled.nil? ? true : enabled
self.tracked_paths ||= %w(app lib)
self.tracked_sql_command ||= %w(SELECT INSERT UPDATE DELETE)
- self.output_path ||= File.join(Rails.root.to_s, 'tmp')
+ self.output_path ||= begin
+ if defined?(::Rails) && ::Rails.root
+ File.join(::Rails.root.to_s, 'tmp')
+ else
+ 'tmp'
+ end
+ end
self
end
end
end
end