aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorHenare Degan <henare.degan@gmail.com>2012-12-10 01:22:58 +1100
committerHenare Degan <henare.degan@gmail.com>2012-12-11 11:09:39 +1100
commit18d0600855b73066c87ea5f2fe33db01fb7a0730 (patch)
tree2a6410446b5ade064aaad9cdd084841f00dc9193 /app/models/info_request.rb
parent4705859e54ca7d8e255f4ccb090ce5f6d9e02ab8 (diff)
Method-style callbacks are deprecated for after_initialize
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb24
1 files changed, 14 insertions, 10 deletions
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