Permalink
Browse files

fix populate

  • Loading branch information...
1 parent c4dc082 commit ef2f5884e8c1e07d8d601c570aef56d5eee999a3 @nofxx nofxx committed Mar 6, 2013
Showing with 7 additions and 2 deletions.
  1. +1 −2 app/models/city.rb
  2. +6 −0 spec/fabricators/city_fabricator.rb
View
@@ -11,18 +11,17 @@ class City
field :souls, type: Integer
field :geom, type: Point, spatial: true
- # spatial_index :geom
attr_writer :x, :y, :z
belongs_to :province
belongs_to :country
has_many :hoods
index name: 1
+ spatial_scope :geom
scope :ordered, order_by(name: 1)
- before_validation :create_geom
validates_presence_of :country
validates_presence_of :name
validates_presence_of :geom
@@ -0,0 +1,6 @@
+Fabricator :city do
+ country
+ name { sequence(:name) { |i| "#{Forgery(:address).city}#{i}" }}
+ geom { [rand(30) - 50, rand(40) - 30] }
+ #code { object.name[0..2].upcase }
+end

0 comments on commit ef2f588

Please sign in to comment.