Socket
Book a DemoInstallSign in
Socket

mobility-ransack

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobility-ransack

1.2.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

Mobility Ransack

Gem Version Build Status Code Climate

Search on translated attributes with Mobility and Ransack.

Installation

Just add the gem to your Gemfile:

gem 'mobility-ransack', '~> 1.2.2'

Now enable the ransack plugin in Mobility's configuration:

Mobility.configure do
  plugins do
    ransack

    # ...
  end
end

This will enable the ransack plugin for all models. Disable it by passing false to the ransack option:

class Post < ApplicationRecord
  extend Mobility
  translates :foo, ransack: false
end

You can search on foo with Ransack just like any untranslated attribute, e.g. if Post has a title attribute translated with the Jsonb backend:

Post.ransack(title_cont: "foo").result
#=> SELECT "posts".* FROM "posts" WHERE ("posts"."title" ->> 'en') ILIKE '%foo%'

Other backends work exactly the same way.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 04 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.