浏览代码

rm unused models

tags/last-sinatra-version
Adrian Short 9 年前
父节点
当前提交
41d704e3c6
共有 1 个文件被更改,包括 0 次插入65 次删除
  1. +0
    -65
      models.rb

+ 0
- 65
models.rb 查看文件

@@ -218,70 +218,5 @@ class Party
has n, :campaigns
end

# These models are now redundant

class Ward
include DataMapper::Resource
property :id, Serial
property :slug, String, :required => true
property :ons_id, String, :required => true
property :name, String, :required => true
property :constituency_id, Integer, :required => true
has n, :councilcandidates, :order => ['surname']
belongs_to :constituency
def self.slugify(name)
name.gsub(/[^\w\s-]/, '').gsub(/\s+/, '-').downcase
end
end

class Councilcandidate
include DataMapper::Resource
property :id, Serial
property :ward_id, Integer, :required => true
property :party_id, Integer, :required => true
property :forenames, String, :required => true
property :surname, String, :required => true
property :address, String, :length => 200
property :postcode, String, :required => true
property :votes_2010, Integer
belongs_to :party
belongs_to :ward
end

class Parliamentcandidate
include DataMapper::Resource
property :id, Serial
property :constituency_id, Integer, :required => true
property :party_id, Integer, :required => true
property :forenames, String, :required => true
property :surname, String, :required => true
property :address, String, :length => 200
property :postcode, String
property :votes_2010, Integer
property :votes_2005, Integer
property :percent_2005, Float

belongs_to :party
belongs_to :constituency
end

class Constituency
include DataMapper::Resource
property :id, Serial
property :name, String, :required => true
has n, :wards, :order => ['name']
has n, :parliamentcandidates, :order => ['surname']
end

DataMapper.setup(:default, ENV['DATABASE_URL'] || "postgres://postgres@localhost:5432/suttonelections")
DataMapper.auto_upgrade!

正在加载...
取消
保存