Updated

app/models / government_response.rb

A
28 lines of codes
2 methods
7.9 complexity/method
6 churn
15.75 complexity
0 duplications
class GovernmentResponse < ActiveRecord::Base
  1. GovernmentResponse has no descriptive comment
belongs_to :petition, touch: true validates :petition, presence: true validates :summary, presence: true, length: { maximum: 200 } validates :details, length: { maximum: 6000 }, 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. GovernmentResponse#default_responded_on calls 'petition.government_response_at' 2 times Locations: 0 1
petition.government_response_at.to_date
  1. GovernmentResponse#default_responded_on calls 'petition.government_response_at' 2 times Locations: 0 1
elsif created_at created_at.to_date elsif new_record? Date.current end end end