diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2013-01-29 13:07:00 +1100 |
---|---|---|
committer | Matthew Landauer <matthew@openaustralia.org> | 2013-01-29 13:07:00 +1100 |
commit | e5931a86d13211460d44a28e52dd4d851958027b (patch) | |
tree | 19e0405e4aa41517334b063f3b620e4cc514d6fd /app/models/info_request.rb | |
parent | e975b6b9448c72781665a69e671f2356d35b900f (diff) |
Workaround for setting default value on attribute when exists? is called
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index aed49bc21..3ee1c3c08 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -1140,8 +1140,13 @@ public private def set_defaults - if self.described_state.nil? - self.described_state = 'waiting_response' + begin + if self.described_state.nil? + self.described_state = 'waiting_response' + end + rescue ActiveModel::MissingAttributeError + # this should only happen on Model.exists?() call. It can be safely ignored. + # See http://www.tatvartha.com/2011/03/activerecordmissingattributeerror-missing-attribute-a-bug-or-a-features/ end # FOI or EIR? if !self.public_body.nil? && self.public_body.eir_only? |