RubyGems.org

boxey

1.0

Boxey provides the [] element reference operator to ActiveRecord classes. # Installation Add this line to your Gemfile: `gem 'boxey'` # Configuration With the boxey gem installed, all ActiveRecord classes gain the [] method, which fetches by the class's primary_key by default. You may specify additional fields, presumably fields that validate uniqueness, by calling the boxey method. class User < ActiveRecord::Base boxey :id, :login, :email validates :login, uniqueness: true validates :email, uniqueness: true end # Use Given the configuration above: `User[1]` returns the first User with an id (or login or email) of `1`. `User['me@example.com']` returns the first User with an email (or id or login) of `'me@example.com'`. `[]` returns `nil` if no match is found.

installgem install boxey
Authors

Rob Head, Ryan Spore, Sean Culver

4,691 total downloads 968 for this version
Owners

95ac4011d0e657db0c3be18000eaeb36

Gemfile
gem 'boxey', '~> 1.0'
Versions
  1. 1.0 October 19, 2012 (3.5 KB)
  2. 0.0.5 October 19, 2012 (3.5 KB)
  3. 0.0.3 October 11, 2012 (3.5 KB)
  4. 0.0.2 October 11, 2012 (3.5 KB)
  5. 0.0.1 October 11, 2012 (3.5 KB)
Show all versions (6 total)
Runtime Dependencies
  1. activerecord >= 0
Development Dependencies
  1. acts_as_fu >= 0
  2. rspec >= 0