Module: CassandraObject::Railties::ControllerRuntime

Extended by:
ActiveSupport::Concern
Defined in:
lib/cassandra_object/railties/controller_runtime.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#append_info_to_payload(payload) ⇒ Object



39
40
41
42
# File 'lib/cassandra_object/railties/controller_runtime.rb', line 39

def append_info_to_payload(payload)
  super
  payload[:cassandra_object_runtime] = (cassandra_object_runtime || 0) + CassandraObject::LogSubscriber.reset_runtime
end

#cleanup_view_runtimeObject



31
32
33
34
35
36
37
# File 'lib/cassandra_object/railties/controller_runtime.rb', line 31

def cleanup_view_runtime
  runtime_before_render = CassandraObject::LogSubscriber.reset_runtime
  runtime = super
  runtime_after_render = CassandraObject::LogSubscriber.reset_runtime
  self.cassandra_object_runtime = runtime_before_render + runtime_after_render
  runtime - runtime_after_render
end

#process_action(action, *args) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/cassandra_object/railties/controller_runtime.rb', line 23

def process_action(action, *args)
  # We also need to reset the runtime before each action
  # because of queries in middleware or in cases we are streaming
  # and it won't be cleaned up by the method below.
  CassandraObject::LogSubscriber.reset_runtime
  super
end