Boxey provides the  element reference operator to ActiveRecord classes.
Add this line to your Gemfile:
With the boxey gem installed, all ActiveRecord classes gain the
 fetches by the class's
primary_key and any other fields that are validated by uniqueness (unless the validation has
Optionally, you may explicitly specify the fields to query and their relative priority by calling the
class User < ActiveRecord::Base boxey :id, :login, :email validates :login, uniqueness: true validates :email, uniqueness: true end
Given the configuration above:
User returns the User with an id of
User['firstname.lastname@example.org'] returns the User with an email of
nil if no match is found.