diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/public_body.rb | 3 | ||||
-rw-r--r-- | app/models/public_body_tag.rb | 48 |
2 files changed, 1 insertions, 50 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 491ffe989..1bd9dcc94 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -42,7 +42,6 @@ class PublicBody < ActiveRecord::Base has_many :info_requests, :order => 'created_at desc' has_many :track_things, :order => 'created_at desc' - has_many :public_body_tags has_tag_string # like find_by_url_name but also search historic url_name if none found @@ -190,7 +189,7 @@ class PublicBody < ActiveRecord::Base def type_of_authority(html = false) types = [] first = true - for tag in self.public_body_tags + for tag in self.tags if PublicBodyCategories::CATEGORIES_BY_TAG.include?(tag.name) desc = PublicBodyCategories::CATEGORY_SINGULAR_BY_TAG[tag.name] if first diff --git a/app/models/public_body_tag.rb b/app/models/public_body_tag.rb deleted file mode 100644 index e24ace7d7..000000000 --- a/app/models/public_body_tag.rb +++ /dev/null @@ -1,48 +0,0 @@ -# == Schema Information -# Schema version: 92 -# -# Table name: public_body_tags -# -# id :integer not null, primary key -# public_body_id :integer not null -# name :text not null -# created_at :datetime not null -# value :text -# - -# models/public_body_tag.rb: -# Categories for public bodies. -# -# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ -# -# $Id: public_body_tag.rb,v 1.29 2009-09-17 21:10:05 francis Exp $ - -class PublicBodyTag < ActiveRecord::Base - strip_attributes! - - validates_presence_of :public_body - validates_presence_of :name - - belongs_to :public_body - - def name_and_value - ret = self.name - if !self.value.nil? - ret += ":" + self.value - end - return ret - end - - def PublicBodyTag.split_tag_into_name_value(tag) - sections = tag.split(/:/) - name = sections[0] - if sections[1] - value = sections[1,sections.size].join(":") - else - value = nil - end - return name, value - end -end - |