Sha256: f7ba0a10ae2e2a3c7db97910c52833f7fb1cdf12ff0d0ff291585c4532b3b3cd
Contents?: true
Size: 781 Bytes
Versions: 11
Compression:
Stored size: 781 Bytes
Contents
# Using with Ruby applications Action Policy is designed to be independent of any framework and does not have specific dependencies on Ruby on Rails. You can [write your policies](writing_policies.md) for non-Rails applications the same way as you would do for Rails applications. In order to have `authorize!` / `allowed_to?` / `authorized` methods, you will have to include [`ActionPolicy::Behaviour`](./behaviour.md) into your class (where you want to perform authorization): ```ruby class PostUpdateAction include ActionPolicy::Behaviour # provide authorization subject (performer) authorize :user attr_reader :user def initialize(user) @user = user end def call(post, params) authorize! post, to: :update? post.update!(params) end end ```
Version data entries
11 entries across 11 versions & 1 rubygems