Skip to content

Private person is an active record extension gem that allows a model to be given privacy settings over arbitrary models and polymorphic relations, putting users’ accounts in control of their own privacy policies.

License

gemvein/private_person

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

PrivatePerson

<img src=“https://badge.fury.io/rb/private_person.svg” alt=“Gem Version” /> <img src=“https://travis-ci.org/gemvein/private_person.svg?branch=master” alt=“Build Status” /> <img src=“https://coveralls.io/repos/gemvein/private_person/badge.png” alt=“Coverage Status” />

Private person is an active record extension gem that allows a model to be given privacy settings over arbitrary models and polymorphic relations, putting users’ accounts in control of their own privacy policies.

Installation

To get started, add private_person to your Gemfile.

gem 'private_person'

Next, run the install:

rails g private_person:install

Set up your models:

# e.g. app/models/user.rb using ChalkDust as the subscription model
class User < ActiveRecord::Base
  acts_as_permissor of: [
                            :following_users,
                            :user_followers # Or any method/scope names that will show who this User is being the permissor of
                        ], class_name: 'User' # The class_name indicates the class of the objects in the methods above.

  def follow(user)
    ChalkDust.subscribe(self, :to => user)
  end

  def following_users
    ChalkDust.publishers_of(self)
  end

  def user_followers
    ChalkDust.subscribers_of(self)
  end
end

# e.g. app/models/page.rb
class Page < ActiveRecord::Base
  acts_as_permissible :by => :user
  belongs_to :user
end

# Then, when you need to know who’s permitted:

@user.is_permitted? friend_user, Page

Contributing to Private Person

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2013-2014 Gem Vein. See LICENSE.txt for further details.

About

Private person is an active record extension gem that allows a model to be given privacy settings over arbitrary models and polymorphic relations, putting users’ accounts in control of their own privacy policies.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages