app/models/hood.rb in geopolitical-1.0.2 vs app/models/hood.rb in geopolitical-1.0.3
- old
+ new
@@ -10,9 +10,14 @@
belongs_to :city
validates :city, presence: true
validates :name, uniqueness: { scope: :city_id }
+ def ensure_slug
+ return unless city
+ self.slug ||= "#{city.slug}-#{name}"
+ end
+
def phone
self[:phone] || city.phone
end
def postal