Categories: None [Edit]

boxey

https://rubygems.org/gems/boxey
https://github.com/roguevalley/boxey
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['[email protected]']` returns the first User with an email (or id or login) of `'[email protected]'`. `[]` returns `nil` if no match is found.

Total

Ranking: 51,487 of 183,107
Downloads: 19,312

Daily

Ranking: 86,038 of 183,092
Downloads: 0

Depended by

RankDownloadsName

Depends on

RankDownloadsName
25817,849,894rspec
35595,989,894activerecord
9,630262,235acts_as_fu

Owners

#GravatarHandle
1iconroguevalley