Plugins - Paranoid Find

StarAdd to favorites

By default, the ActiveRecord.find method queries the database for all columns in an underlying table and exposes their contents as attributes of the objects it returns. On a wide table, this may be inefficient, especialy if only a few columns are needed in a typical query.

The ParanoidFind plugin overrides the default behavior of the ActiveRecord.find method to query only the primary key column of an underlying table. A new class method ActiveRecord.select is made available to specify other default columns, or all columns using the :all symbol, if desired. As before, full control of the columns selected is still available using the :select option of the ActiveRecord.find method.

The plugin works by reimplementing the private ActiveRecord.find_initial, ActiveRecord.find_every, and ActiveRecord.find_from_ids methods and adding an appropriate :select option, if one is not already defined.

Curt A. Gilman

http://github.com/curt/paranoid_find/

git://github.com/curt/paranoid_find.git

Rails' (MIT)

  • Currently 4.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Model

Tags

Comments

Add a comment

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?