Pārlūkot izejas kodu

Restore Ward model

tags/last-sinatra-version
Adrian Short pirms 9 gadiem
vecāks
revīzija
0675495fa7
1 mainītis faili ar 13 papildinājumiem un 0 dzēšanām
  1. +13
    -0
      models.rb

+ 13
- 0
models.rb Parādīt failu

@@ -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!

Notiek ielāde…
Atcelt
Saglabāt