Updated

app/models / email_requested_receipt.rb

A
25 lines of codes
4 methods
3.1 complexity/method
2 churn
12.45 complexity
0 duplications
class EmailRequestedReceipt < ActiveRecord::Base
  1. EmailRequestedReceipt has no descriptive comment
belongs_to :petition, touch: true validates :petition, presence: true validates :petition_id, uniqueness: true def get(name) raise ArgumentError unless valid_timestamp?(name) self[name] end def set(name, time) raise ArgumentError unless valid_timestamp?(name) update_column(name, time) end private def valid_timestamp?(name) possible_timestamps.include? name end def possible_timestamps @_possiblities ||= attributes.keys - ['id', 'petition_id', 'created_at', 'updated_at'] end end