Updated

app/models/archived / government_response.rb

A
30 lines of codes
2 methods
7.1 complexity/method
5 churn
14.1 complexity
0 duplications
require_dependency 'archived' module Archived class GovernmentResponse < ActiveRecord::Base
  1. Archived::GovernmentResponse has no descriptive comment
belongs_to :petition, touch: true validates :petition, presence: true validates :summary, presence: true, length: { maximum: 500 } validates :details, length: { maximum: 10000 }, allow_blank: true validates :responded_on, presence: true after_create do petition.touch(:government_response_at) unless petition.government_response_at? end def responded_on super || default_responded_on end private def default_responded_on if petition && petition.government_response_at
  1. Archived::GovernmentResponse#default_responded_on calls 'petition.government_response_at' 2 times Locations: 0 1
petition.government_response_at.to_date
  1. Archived::GovernmentResponse#default_responded_on calls 'petition.government_response_at' 2 times Locations: 0 1
elsif created_at created_at.to_date end end end end