diff options
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 24 |
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 |