Module: Strongbolt::Helpers

Defined in:
lib/strongbolt/helpers.rb

Instance Method Summary collapse

Instance Method Details

#can?(*args, &block) ⇒ Boolean



3
4
5
6
7
8
9
10
# File 'lib/strongbolt/helpers.rb', line 3

def can?(*args, &block)
  # Block can be used when testing an instance
  Strongbolt.without_authorization do
    args.insert 1, yield if block.present?

    return current_user.can?(*args)
  end
end

#cannot?(*args, &block) ⇒ Boolean



12
13
14
# File 'lib/strongbolt/helpers.rb', line 12

def cannot?(*args, &block)
  !can?(*args, &block)
end