Module: KittyPolicy::Helper

Extended by:
Helper
Included in:
Helper
Defined in:
lib/kitty_policy/helper.rb

Instance Method Summary collapse

Instance Method Details

#method_name(action, subject = nil) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/kitty_policy/helper.rb', line 7

def method_name(action, subject = nil)
  if subject
    "can_#{action}_#{underscore(subject_to_string(subject)).tr('/', '_')}?"
  else
    "can_#{action}?"
  end
end