瀏覽代碼

Added parliamentary consisituencies

tags/last-sinatra-version
Adrian Short 14 年之前
父節點
當前提交
a51cd16e5c
共有 2 個檔案被更改,包括 16 行新增1 行删除
  1. +12
    -1
      lib/models.rb
  2. +4
    -0
      views/wards.haml

+ 12
- 1
lib/models.rb 查看文件

@@ -18,8 +18,10 @@ class Ward
property :id, Serial
property :ons_id, String, :required => true
property :name, String, :required => true
property :constituency_id, Integer, :required => true
has n, :councilcandidates
belongs_to :constituency
end

class Party
@@ -44,4 +46,13 @@ class Councilcandidate

belongs_to :party
belongs_to :ward
end

class Constituency
include DataMapper::Resource
property :id, Serial
property :name, String, :required => true
has n, :wards
end

+ 4
- 0
views/wards.haml 查看文件

@@ -9,6 +9,10 @@
= @ward.name
Ward

%h2
= @ward.constituency.name
Constituency

#candidates
%h2
Council candidates in


Loading…
取消
儲存