Skip to content

a Ruby gem that provides an ActiveRecord mixin specific to people at OSU

Notifications You must be signed in to change notification settings

ASCTech/ohio_state_person

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ohio_state_person

Gem page

Description

This is an extraction of the common user model code in our Rails apps.

Synopsis

class Student < ActiveRecord::Base
  is_a_buckeye
end

Features

It validates the format and uniqueness of name_n and emplid.

It sets the id of new records to emplid.to_i, and validates that the id is always emplid.to_i.

It adds a class method: search, which searches by emplid, name_n, last_name, first_name, first_name last_name, or just last_name, depending on whether the search term looks like an emplid, name_n, etc.

It adds an instance method: email, which is just "#{name_n}@osu.edu".

Usage

Just call is_a_buckeye from the class level in your model. This mixin expects emplid, name_n, first_name, and last_name to be attributes of the model in question.

About

a Ruby gem that provides an ActiveRecord mixin specific to people at OSU

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages