New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

poor_man_search

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

poor_man_search

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

PoorManSearch

This module implement Poor Man's Search Engin to a active-record object.

Poor Man's Search Engin is a SQL anti pattern that using LIKE with wildcards search..

Installation

Add this line to your application's Gemfile:

gem 'poor_man_search'

And then execute:

$ bundle

Usage

Example

A master table : users

emailnamerankregistered_at
taro@yamada.example.com山田太郎12013-12-31 23:21:11
hana@yamada.example.com山田華32014-2-28 3:15:00
chad@miller.example.comChad Miller12014-2-28 16:23:15

Configure like this.

class User < ActiveRecord::Base
  extend PoorManSearch::Searchable
  string_search :name, :email
  number_search :rank
  time_search :registered_at
end
User.search "yamada"
emailnamerankregistered_at
taro@yamada.example.com山田太郎12013-12-31 23:21:11
hana@yamada.example.com山田華32014-2-28 3:15:00

User.search "yamada 太郎"
emailnamerankregistered_at
taro@yamada.example.com山田太郎12013-12-31 23:21:11

User.search "1"
emailnamerankregistered_at
taro@yamada.example.com山田太郎12013-12-31 23:21:11
chad@miller.example.comChad Miller12014-2-28 16:23:15

User.search "2/28"
emailnamerankregistered_at
hana@yamada.example.com山田華32014-2-28 3:15:00
chad@miller.example.comChad Miller12014-2-28 16:23:15

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 10 Apr 2014

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc