README.md in action_policy-0.4.4 vs README.md in action_policy-0.5.0
- old
+ new
@@ -1,7 +1,8 @@
[](https://badge.fury.io/rb/action_policy)
-[](https://travis-ci.org/palkan/action_policy)
+
+
[](https://actionpolicy.evilmartians.io)
# Action Policy
Authorization framework for Ruby and Rails applications.
@@ -19,11 +20,10 @@
- Seattle.rb, 2019 "A Denial!" talk ([slides](https://speakerdeck.com/palkan/seattle-dot-rb-2019-a-denial))
- RailsConf, 2018 "Access Denied" talk ([video](https://www.youtube.com/watch?v=NVwx0DARDis), [slides](https://speakerdeck.com/palkan/railsconf-2018-access-denied-the-missing-guide-to-authorization-in-rails))
-
## Integrations
- GraphQL Ruby ([`action_policy-graphql`](https://github.com/palkan/action_policy-graphql))
## Installation
@@ -34,11 +34,13 @@
gem "action_policy", "~> 0.4.0"
```
And then execute:
- $ bundle
+```sh
+bundle install
+```
## Usage
Action Policy relies on resource-specific policy classes (just like [Pundit](https://github.com/varvet/pundit)).
@@ -86,10 +88,9 @@
end
end
```
\* See [Non-Rails Usage](docs/non_rails.md) on how to add `authorize!` to any Ruby project.
-
When authorization is successful (i.e., the corresponding rule returns `true`), nothing happens, but in case of authorization failure `ActionPolicy::Unauthorized` error is raised.
There is also an `allowed_to?` method which returns `true` or `false`, and could be used, in views, for example: