aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorlizconlan <liz@mysociety.org>2014-07-22 12:35:40 +0100
committerLouise Crow <louise.crow@gmail.com>2014-09-22 12:39:02 +0100
commitcb2dfa0c464e72c4d0eb00e5381e9d24c57d63e2 (patch)
tree9134a5cd15ff3fcd8e2d9a5b544cbc8c00c4718d /app/models
parent74431c14502314001120883b5ee67298afc3ccf3 (diff)
List categories without headings on the admin screen
Diffstat (limited to 'app/models')
-rw-r--r--app/models/public_body_category.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/public_body_category.rb b/app/models/public_body_category.rb
index c0d8e07c6..2e2c8d74e 100644
--- a/app/models/public_body_category.rb
+++ b/app/models/public_body_category.rb
@@ -40,6 +40,15 @@ class PublicBodyCategory < ActiveRecord::Base
categories
end
+ def self.without_headings
+ sql = %Q| SELECT * FROM public_body_categories pbc
+ WHERE pbc.id NOT IN (
+ SELECT public_body_category_id AS id
+ FROM public_body_categories_public_body_headings
+ ) |
+ PublicBodyCategory.find_by_sql(sql)
+ end
+
# Called from the data files themselves
def self.add(locale, categories)
@heading = nil