Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Trilogy database adapter #1500

Open
navels opened this issue Jun 28, 2024 · 0 comments · May be fixed by #1501
Open

Support for Trilogy database adapter #1500

navels opened this issue Jun 28, 2024 · 0 comments · May be fixed by #1501

Comments

@navels
Copy link

navels commented Jun 28, 2024

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.

@navels navels linked a pull request Jun 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant