From 18d0600855b73066c87ea5f2fe33db01fb7a0730 Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Mon, 10 Dec 2012 01:22:58 +1100 Subject: Method-style callbacks are deprecated for after_initialize --- app/models/info_request.rb | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'app/models/info_request.rb') diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 9029ec0ef..df362b410 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -81,6 +81,8 @@ class InfoRequest < ActiveRecord::Base 'blackhole' # just dump them ] + after_initialize :set_defaults + def self.enumerate_states states = [ 'waiting_response', @@ -171,16 +173,6 @@ class InfoRequest < ActiveRecord::Base OLD_AGE_IN_DAYS = 21.days - def after_initialize - if self.described_state.nil? - self.described_state = 'waiting_response' - end - # FOI or EIR? - if !self.public_body.nil? && self.public_body.eir_only? - self.law_used = 'eir' - end - end - def visible_comments self.comments.find(:all, :conditions => 'visible') end @@ -1155,5 +1147,17 @@ public yield(column.human_name, self.send(column.name), column.type.to_s, column.name) end end + + private + + def set_defaults + if self.described_state.nil? + self.described_state = 'waiting_response' + end + # FOI or EIR? + if !self.public_body.nil? && self.public_body.eir_only? + self.law_used = 'eir' + end + end end -- cgit v1.2.3