lib/niceql.rb in niceql-0.1.22 vs lib/niceql.rb in niceql-0.1.23

- old
+ new

@@ -33,11 +33,11 @@ end module Prettifier INLINE_VERBS = %w(WITH ASC (IN\s) COALESCE AS WHEN THEN ELSE END AND UNION ALL ON DISTINCT INTERSECT EXCEPT EXISTS NOT COUNT ROUND CAST).join('| ') - NEW_LINE_VERBS = 'SELECT|FROM|WHERE|CASE|ORDER BY|LIMIT|GROUP BY|(RIGHT |LEFT )*(INNER |OUTER )*JOIN|HAVING|OFFSET|UPDATE' + NEW_LINE_VERBS = 'SELECT|FROM|WHERE|CASE|ORDER BY|LIMIT|GROUP BY|(RIGHT |LEFT )*(INNER |OUTER )*JOIN( LATERAL)*|HAVING|OFFSET|UPDATE' POSSIBLE_INLINER = /(ORDER BY|CASE)/ VERBS = "#{NEW_LINE_VERBS}|#{INLINE_VERBS}" STRINGS = /("[^"]+")|('[^']+')/ BRACKETS = '[\(\)]' SQL_COMMENTS = /(\s*?--.+\s*)|(\s*?\/\*[^\/\*]*\*\/\s*)/ @@ -227,11 +227,11 @@ end end module ErrorExt def to_s - if Niceql.config.prettify_pg_errors && ActiveRecord::Base.configurations[Rails.env]['adapter'] == 'postgresql' + if Niceql.config.prettify_pg_errors && ActiveRecord::Base.connection_config['adapter'] == 'postgresql' Prettifier.prettify_err(super) else super end end @@ -248,10 +248,10 @@ def initialize self.pg_adapter_with_nicesql = false self.indentation_base = 2 self.open_bracket_is_newliner = false self.prettify_active_record_log_output = false - self.prettify_pg_errors = defined? ::ActiveRecord::Base && ActiveRecord::Base.configurations[Rails.env]['adapter'] == 'postgresql' + self.prettify_pg_errors = defined? ::ActiveRecord::Base && ActiveRecord::Base.connection_config['adapter'] == 'postgresql' end end def self.configure