Skip to content

Support for Trilogy database adapter #1500

Open
@navels

Description

@navels

When wildcard matching, ransack takes care to escape any special characters in the search term. This is from lib/ransack/constants.rb:

module_function
  # replace % \ to \% \\
  def escape_wildcards(unescaped)
    case ActiveRecord::Base.connection.adapter_name
    when "Mysql2".freeze
      # Necessary for MySQL
      unescaped.to_s.gsub(/([\\%_])/, '\\\\\\1')
    when "PostgreSQL".freeze
      # Necessary for PostgreSQL
      unescaped.to_s.gsub(/([\\%_.])/, '\\\\\\1')
    else
      unescaped
    end
  end
end

There is a new MySQL adapter called Trilogy: https://github.blog/2022-08-25-introducing-trilogy-a-new-database-adapter-for-ruby-on-rails/

Can we get support for this adapter? I'm not sure how much of the ransack code would be impacted, this (wildcard search escaping) just happened to be the thing I ran into.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions