Project

humanity

0.0
No commit activity in last 3 years
No release in over 3 years
Mix in Humanity and get common user model functionality
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 3.0.0
 Project Readme

Humanity

Humanity is a Ruby on Rails mixin that aims to consolidate typical user model functionality into a reusable Ruby gem.

Installation

Add the gem to your Gemfile

gem 'humanity'

Include Humanity in your user model

class User < ActiveRecord::Base
  include Humanity::Base
  ...
end

In the terminal run

rails generate humanity
rake db:migrate

Tip: If you don't want your model to be called user, or you'd like to make other changes, just edit the generated create_user migration before running rake db:migrate.

What You Get

Out of the box your user model will have the following attributes

  • username
  • first_name
  • last_name
  • title
  • email
  • department
  • photo_url
  • current_login_at
  • last_login_at
  • login_count

the following associations

  • assignments
  • roles

Note: users have_many roles through assignments

and the following methods

  • name
  • role_symbols
    for declarative_authorization_support
  • has_role?(role)
  • admin?
  • developer?
  • update_roles!(role_names, source)
  • update_login_info!