Project

favorites

0.0
No commit activity in last 3 years
No release in over 3 years
Favorites lets you access specific ActiveRecord objects with a shortcut
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 2.11.0
 Project Readme

Favorites - A Ruby Gem

Build Status

Speed-dial for your ActiveRecords! Set up shortcuts for commonly-accessed records so you can get them easily.

Tired of typing User.find_by_email("chris@arches.io") to get your user? Now you can get it directly with User.chris

Usage

  1. Include the library in your ActiveRecord class
  2. Set up your favorites with the favorite method.
  • First argument is the column to search, your favorite will forward to the klass.find_by_<arg1> method
  • Second argument is the shortcut name, and the value to search against
class User < ActiveRecord::Base
  include Favorites

  favorite :email, {
    chris: "chris@arches.io",
    joe: "joe@joe.io"
  }
end
  1. That's it! Now you can use your favorite in your code or console.
  • In this example, User.chris will translate into User.find_by_email("chris@arches.io")
  • In this example, User.joe will translate into User.find_by_email("joe@joe.io")