Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ApplicationPolicy
- attr_reader :context, :record, :cookies, :user
- delegate :cookies, to: :context
- delegate :user, to: :context
- def initialize(context, record)
- @context = context
- @record = record
- end
- def index?
- false
- end
- def show?
- false
- end
- def create?
- false
- end
- def new?
- create?
- end
- def update?
- false
- end
- def edit?
- update?
- end
- def destroy?
- false
- end
- class Scope
- attr_reader :user, :scope
- def initialize(user, scope)
- @user = user
- @scope = scope
- end
- def resolve
- scope.all
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement