aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-08-04 00:37:41 +0100
committerFrancis Irving <francis@mysociety.org>2010-08-04 00:37:41 +0100
commit47e9c70b6d70c7ffbbb5232b56c0463c68600c3f (patch)
tree7487e4753e6abc6075bce992a9d455d4d682087c /app/models
parentcbb1023f86be15a3ce7efc9b0e54e1725c9561cf (diff)
Allow multiple keys the same
Diffstat (limited to 'app/models')
-rw-r--r--app/models/public_body.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index e0d02a5b6..ae1a38723 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -216,13 +216,23 @@ class PublicBody < ActiveRecord::Base
end
return false
end
- def get_tag_value(tag)
+ class TagNotFound < StandardError
+ end
+ def get_tag_values(tag)
+ found = false
+ results = []
for public_body_tag in self.public_body_tags
if public_body_tag.name == tag
- return public_body_tag.value
+ found = true
+ if !public_body_tag.value.nil?
+ results << public_body_tag.value
+ end
end
end
- return false
+ if !found
+ raise TagNotFound
+ end
+ return results
end
def add_tag_if_not_already_present(tag)
self.tag_string = self.tag_string + " " + tag