diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-04-22 17:40:17 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-05-07 13:25:16 +0100 |
commit | 47fcd7ea7c9065e2727f1954be8bbffcf17e4114 (patch) | |
tree | 5476b55ef0ad014629f5caea11f74efa36c3f24d /app/models/info_request.rb | |
parent | 8b5188e9fe748a8420b9d8ee45eedacb8dd09e48 (diff) |
Don't load PublicBody when initalizing InfoRequest
Doesn't need to try to set the default law_used once it's persisted,
so we save a query each time we find an InfoRequest
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 8f464e786..0ca3a1279 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -1394,8 +1394,9 @@ public # 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? + if new_record? && public_body && public_body.eir_only? self.law_used = 'eir' end end |