./lib/common/policy.rb in lux-fw-0.1.35 vs ./lib/common/policy.rb in lux-fw-0.2.1
- old
+ new
@@ -1,12 +1,12 @@
# frozen_string_literal: true
# base caller
# UserPolicy.new(model: @model, user: User.current).can?(:update) -> can current user update @user
-# ApplicationPolicy.new(user: Lux.page.var.user).can?(:admin_login?) -> can current user login to admin
+# ApplicationPolicy.new(user: Lux.current.var.user).can?(:admin_login?) -> can current user login to admin
# block will capture error message and be triggered only if error is present
-# ApplicationPolicy.can?(:login) { |msg| http_error 401, "Err: #{msg}".red; return 'no access' }
+# User.can?(:login) { |msg| http_error 401, "Err: #{msg}".red; return 'no access' }
class Policy
def initialize hash
for k, v in hash