lib/popolo/mixins/sluggable.rb in popolo-0.0.1 vs lib/popolo/mixins/sluggable.rb in popolo-0.0.2
- old
+ new
@@ -8,9 +8,11 @@
# A lowercase identifier composed of letters, numbers and dashes.
field :slug, type: String
# The field used to sort the document.
field :sort_name, type: String
+ index sort_name: 1
+
validates_presence_of slug_source, :slug, :sort_name
before_validation :set_slug_and_sort_name
end