GithubHelp home page GithubHelp logo

thec0keman / humanity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from biola/humanity

0.0 1.0 0.0 154 KB

Mix in Humanity and get common user model functionality

License: MIT License

Ruby 100.00%

humanity's Introduction

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!

humanity's People

Watchers

John Ratcliff avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.