Skip to content
/ humanity Public

Mix in Humanity and get common user model functionality

License

Notifications You must be signed in to change notification settings

biola/humanity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

Mix in Humanity and get common user model functionality

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages