Module: Protocolist::ControllerAdditions

Extended by:
ActiveSupport::Concern
Includes:
Initializer, Util::DataProc
Defined in:
lib/protocolist/controller_additions.rb,
lib/protocolist/controller_additions/initializer.rb

Defined Under Namespace

Modules: ClassMethods, Initializer

Instance Method Summary collapse

Methods included from Initializer

#initialize_protocolist

Instance Method Details

#fire(activity_type = nil, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/protocolist/controller_additions.rb', line 10

def fire(activity_type = nil, options = {})
  target = case options[:target]
           when nil
             instance_variable_get("@#{controller_name.singularize}")
           when false
             nil
           else
             options[:target]
           end

  activity_type ||= action_name.to_sym
  options = options.merge(target: target)

  Protocolist.fire(activity_type, options)
end