瀏覽代碼

Restore Ward model

tags/last-sinatra-version
Adrian Short 9 年之前
父節點
當前提交
0675495fa7
共有 1 個檔案被更改,包括 13 行新增0 行删除
  1. +13
    -0
      models.rb

+ 13
- 0
models.rb 查看文件

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

class Ward
include DataMapper::Resource

property :id, Serial
property :slug, String, :required => true
property :ons_id, String, :required => true
property :name, String, :required => true

def self.slugify(name)
name.gsub(/[^\w\s-]/, '').gsub(/\s+/, '-').downcase
end
end

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

Loading…
取消
儲存