aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-02-20 01:04:18 -0800
committerSeb Bacon <seb.bacon@gmail.com>2012-02-20 01:04:18 -0800
commit1f8c9401cb1ef69b74024261b7d72ffceeaf6b9b (patch)
tree11abcd1580af0ea2840bb4ded5947ee2ec911dcd /app/models
parent557b1c8208ae9008161e2acc1fcdaa55c9be629d (diff)
parent0224741eb828035927995654e880f0722eea8451 (diff)
Merge pull request #433 from henare/issue-271
Closes Issue 271
Diffstat (limited to 'app/models')
-rw-r--r--app/models/public_body.rb16
1 files changed, 4 insertions, 12 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 961fa3cbb..a18af8c69 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -282,19 +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 != ''
- return self.home_page
+ if home_page && !home_page.empty?
+ home_page[URI::regexp(%w(http https))] ? home_page : "http://#{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?