aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenare Degan <henare.degan@gmail.com>2012-02-16 17:18:10 +1100
committerHenare Degan <henare.degan@gmail.com>2012-02-16 17:18:10 +1100
commit8489d3849dc65a2f5e87c5cca9ecca6526517a54 (patch)
tree57bdded427c64140aca0c7186f08cb07c78da454
parent2802ab3ab3e993ee3bbf390eddd6cf356303b617 (diff)
Refactor method
-rw-r--r--app/models/public_body.rb21
1 files changed, 4 insertions, 17 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 23f71333d..f8c12e1e8 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -282,24 +282,11 @@ class PublicBody < ActiveRecord::Base
# Guess home page from the request email, or use explicit override, or nil
# if not known.
def calculated_home_page
- # manual override for ones we calculate wrongly
- if self.home_page != ''
- # Add standard URL prefix
- if home_page[0..10] == 'http://www.'
- return self.home_page
- else
- return "http://www.#{self.home_page}"
- end
+ if home_page && !home_page.empty?
+ home_page[0..10] == 'http://www.' ? home_page : "http://www.#{home_page}"
+ elsif request_email_domain
+ "http://www.#{request_email_domain}"
end
-
- # extract the domain name from the FOI request email
- url = self.request_email_domain
- if url.nil?
- return nil
- end
-
- # add standard URL prefix
- return "http://www." + url
end
# Are all requests to this body under the Environmental Information Regulations?