Scan Fields plugin

Plugin details

Builds an array of search conditions which will by default search all columns of a model's table for a given pattern.

Websitehttp://www.tenebrous.com/ Repositorysvn://plugins.tenebrous.com/scan_fields Tags Search LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install svn://plugins.tenebrous.com/scan_fields

Usage:

scan_fields(search_string, options)


Examples:

User.find(:all, :conditions => User.scan_fields("michael"))
User.find(:all, :conditions => User.scan_fields("11:11PM"))
User.find(:all, :conditions => User.scan_fields("2/30/80"))
User.find(:all, :conditions => User.scan_fields("03-13-2002"))
User.find(:all, :conditions => User.scan_fields(32, :exclude => 'id'))
User.find(:all, :conditions => User.scan_fields("michael", :exclude => ['zipcode', 'address'], :trim => 2))


You may also use the + operator to combine conditions.
For example:

User.find(:all, :conditions => User.scan_fields("ruby")+['some_id=?',32])


Options:

 :exclude # Columns to exclude from the query. This can be either a string (1 column) or an array of column names.
 :trim    # Specifies how many characters to trim from the beginning and end of the search string before searching. The default is 0.
            Note: If the the value would result in an empty string, the search string will be unaffeted.
 :case    # Specifies whether the pattern match should be case sensitive. The possible values are true, and false (default).

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | Back in time (2 older versions) | Last edited by: scott, 7 months ago