Method: Croods::Resource::Authorization#public_actions

Defined in:
lib/croods/resource/authorization.rb

#public_actions(*names) ⇒ Object Also known as: public_action



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/croods/resource/authorization.rb', line 31

def public_actions(*names)
  return unless names

  names = [names] if names.is_a?(Symbol)

  extend_controller do
    skip_before_action :authenticate_user!, only: names
  end

  actions.each do |action|
    next unless names.include?(action.name)

    action.public = true
  end
end