Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README. Reorganize installation steps #425

Merged
merged 2 commits into from
Nov 18, 2017

Conversation

sankalpk
Copy link
Contributor

@sankalpk sankalpk commented Nov 8, 2016

Your README is pretty thorough and well thought out. Some minor changes to make it a little easier to understand. Explained in comments below.

@@ -5,11 +5,11 @@ Very simple Roles library without any authorization enforcement supporting scope
Let's see an example:

```ruby
user.has_role?(:moderator, Forum.first)
user.has_role?(:moderator, @forum)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A forum instance gives you one less concept to think about when trying to understand the example.

=> false # if user is moderator of another Forum
```

This library can be easily integrated with any authentication gem ([devise](https://github.com/plataformatec/devise), [Authlogic](https://github.com/binarylogic/authlogic), [Clearance](https://github.com/thoughtbot/clearance)) and authorization gem<span style="color: red"><strong>*</strong></span> ([CanCanCan](https://github.com/CanCanCommunity/cancancan), [authority](https://github.com/nathanl/authority))
This library can be easily integrated with any authentication gem ([devise](https://github.com/plataformatec/devise), [Authlogic](https://github.com/binarylogic/authlogic), [Clearance](https://github.com/thoughtbot/clearance)) and authorization gem<span style="color: red"><strong>*</strong></span> ([CanCanCan](https://github.com/CanCanCommunity/cancancan), [authority](https://github.com/nathanl/authority), [Pundit](https://github.com/elabs/pundit))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use it with Pundit, so thought it'd be nice to include it in the list

First, create your Role model and migration file using this generator:
First, use the generator to setup Rolify. Role and User class are the default names. However, you can specify any class name you want. For the User class name, you would probably use the one provided by your authentication solution.

If you want to use Mongoid instead of ActiveRecord, just add `--orm=mongoid` argument, and skip to step #3.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to talk a bit about the options and names for the command prior to showing the command. For e.g. I'm used to copy and pasting commands as I read. In this case, if I have a different User class name or wanted to name Role something differently, I would've already pasted the command into the terminal and it might be a bit of a pain to undo.

For the User class name, you would probably use the one provided by your authentication solution. rolify just adds some class methods in an existing User class.

If you want to use Mongoid instead of ActiveRecord, just add `--orm=mongoid` argument, and skip to step #3
The generator will create your Role model, add a migration file, and update your User class with new class methods.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The summary of what the generator does helps the user understand more of what is going on.

Copy link
Member

@EppO EppO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Neat clean-up.

@coveralls
Copy link

coveralls commented Nov 18, 2017

Coverage Status

Coverage remained the same at 93.089% when pulling 74c02d2 on sankalpk:dev into 9756943 on RolifyCommunity:master.

@EppO EppO merged commit 8377e70 into RolifyCommunity:master Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants