diff --git a/app/controllers/concerns/filterable.rb b/app/controllers/concerns/filterable.rb index 9a9e6b614..d0f1cb851 100644 --- a/app/controllers/concerns/filterable.rb +++ b/app/controllers/concerns/filterable.rb @@ -98,7 +98,7 @@ def filter_by_missing_tag(models, missingtag, library) tag_regex_build = [] regexes = ((missingtag != "") ? [missingtag] : Library.find_param(library).tag_regex) # Regexp match syntax - postgres is different from MySQL and SQLite - regact = ApplicationRecord.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) ? "~" : "REGEXP" + regact = (ApplicationRecord.connection.adapter_name == "PostgreSQL") ? "~" : "REGEXP" regexes.each do |reg| qreg = ActiveRecord::Base.connection.quote(reg) tag_regex_build.push "(select count(*) from tags join taggings on tags.id=taggings.tag_id where tags.name #{regact} #{qreg} and taggings.taggable_id=models.id and taggings.taggable_type='Model')<1" diff --git a/app/views/application/_tag_list.html.erb b/app/views/application/_tag_list.html.erb index 453fadb5d..f149e49df 100644 --- a/app/views/application/_tag_list.html.erb +++ b/app/views/application/_tag_list.html.erb @@ -3,7 +3,7 @@ <% if @models tierunset = tiers.map { |tier| reg = ActiveRecord::Base.connection.quote("^" + tier + ":") - regact = ApplicationRecord.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) ? "~" : "REGEXP" + regact = (ApplicationRecord.connection.adapter_name == "PostgreSQL") ? "~" : "REGEXP" [tier, @models.where("(select count(*) from tags join taggings on tags.id=taggings.tag_id where tags.name #{regact} #{reg} and taggings.taggable_id=models.id and taggings.taggable_type='Model')<1").count] }.to_h end %> diff --git a/app/views/layouts/settings.html.erb b/app/views/layouts/settings.html.erb index 3ed86ff74..99aed4a13 100644 --- a/app/views/layouts/settings.html.erb +++ b/app/views/layouts/settings.html.erb @@ -44,7 +44,7 @@ - <% if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && ApplicationRecord.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) %> + <% if ApplicationRecord.connection.adapter_name == "PostgreSQL" %>