lib/picky/sources/db.rb in picky-3.2.0 vs lib/picky/sources/db.rb in picky-3.3.0

- old
+ new

@@ -31,12 +31,23 @@ attr_reader :connection_options, :options @@traversal_id = :__picky_id def initialize select_statement, options = { file: 'app/db.yml' } + check_gem + @select_statement = select_statement @database = create_database_adapter @options = options + end + + # Tries to require the active_record gem. + # + def check_gem # :nodoc: + require 'active_record' + rescue LoadError + warn_gem_missing 'active_record', 'the (ActiveRecord) DB source' + exit 1 end def to_s parameters = [select_statement.inspect] parameters << options unless options.empty? \ No newline at end of file