Sha256: d011dbbd2ffa03df33b7c8e73e1c2625d5396f0c6b51acf4bac87167e49537c9
Contents?: true
Size: 831 Bytes
Versions: 11
Compression:
Stored size: 831 Bytes
Contents
require 'allowance' module Happy module Extensions module Permissions module ContextExtensions extend ActiveSupport::Concern def permissions(&blk) @permissions ||= Allowance.define end def can?(*args) permissions.allowed?(*args) end end module ControllerExtensions extend ActiveSupport::Concern included do delegate :can?, :to => :context end module ClassMethods attr_accessor :permissions_blk def permissions(&blk) self.permissions_blk = blk end end end end end end Happy::Context.send(:include, Happy::Extensions::Permissions::ContextExtensions) Happy::Controller.send(:include, Happy::Extensions::Permissions::ControllerExtensions)
Version data entries
11 entries across 11 versions & 1 rubygems