Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix populate

  • Loading branch information...
commit ef2f5884e8c1e07d8d601c570aef56d5eee999a3 1 parent c4dc082
Marcos Piccinini nofxx authored
Showing with 7 additions and 2 deletions.
  1. +1 −2  app/models/city.rb
  2. +6 −0 spec/fabricators/city_fabricator.rb
3  app/models/city.rb
View
@@ -11,7 +11,6 @@ class City
field :souls, type: Integer
field :geom, type: Point, spatial: true
- # spatial_index :geom
attr_writer :x, :y, :z
belongs_to :province
@@ -19,10 +18,10 @@ class City
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
6 spec/fabricators/city_fabricator.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.