|
|
@@ -19,12 +19,12 @@ end |
|
|
|
class Ward |
|
|
|
include DataMapper::Resource |
|
|
|
|
|
|
|
property :id, Serial |
|
|
|
property :ons_id, String, :required => true |
|
|
|
property :name, String, :required => true |
|
|
|
property :constituency_id, Integer, :required => true |
|
|
|
property :id, Serial |
|
|
|
property :ons_id, String, :required => true |
|
|
|
property :name, String, :required => true |
|
|
|
property :constituency_id, Integer, :required => true |
|
|
|
|
|
|
|
has n, :councilcandidates, :order => [ 'surname' ] |
|
|
|
has n, :councilcandidates, :order => ['surname'] |
|
|
|
belongs_to :constituency |
|
|
|
|
|
|
|
def self.slugify(name) |
|
|
@@ -39,8 +39,8 @@ class Party |
|
|
|
property :id, Serial |
|
|
|
property :name, String, :required => true |
|
|
|
|
|
|
|
has n, :councilcandidates, :order => [ 'surname' ] |
|
|
|
has n, :parliamentcandidates, :order => [ 'surname' ] |
|
|
|
has n, :councilcandidates, :order => ['surname'] |
|
|
|
has n, :parliamentcandidates, :order => ['surname'] |
|
|
|
end |
|
|
|
|
|
|
|
class Councilcandidate |
|
|
@@ -79,8 +79,8 @@ class Constituency |
|
|
|
property :id, Serial |
|
|
|
property :name, String, :required => true |
|
|
|
|
|
|
|
has n, :wards, :order => 'name' |
|
|
|
has n, :parliamentcandidates, :order => [ 'surname' ] |
|
|
|
has n, :wards, :order => ['name'] |
|
|
|
has n, :parliamentcandidates, :order => ['surname'] |
|
|
|
end |
|
|
|
|
|
|
|
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/db.sqlite3") |