Updated

app/controllers/concerns / form_tracking.rb

A
39 lines of codes
8 methods
3.0 complexity/method
1 churn
24.0 complexity
0 duplications
module FormTracking
  1. FormTracking has no descriptive comment
extend ActiveSupport::Concern private def generate_form_token
  1. FormTracking#generate_form_token doesn't depend on instance state (maybe move it to another class?)
Authlogic::Random.friendly_token end def build_form_request { "form_token" => generate_form_token, "form_requested_at" => current_time } end def form_request_id petition_id.to_s end def form_requests session["form_requests"] ||= {}
  1. FormTracking#form_requests calls 'session["form_requests"]' 2 times Locations: 0 1
session["form_requests"]
  1. FormTracking#form_requests calls 'session["form_requests"]' 2 times Locations: 0 1
end def form_request form_requests[form_request_id] ||= build_form_request
  1. FormTracking#form_request calls 'form_requests[form_request_id]' 2 times Locations: 0 1
form_requests[form_request_id]
  1. FormTracking#form_request calls 'form_requests[form_request_id]' 2 times Locations: 0 1
end def form_token form_request["form_token"] end def form_requested_at form_request["form_requested_at"] end def image_loaded_at cookies.encrypted[form_token] end end