0

Paperclip is generating my files and appending to its filename an index, but when stored to db it is sorted not the way i want (image below). Note that is not a natural sort (1,10,2,3,4,5...) instead of (1,2,3,4,5,6,7,8,9,10..).

What am i have to do? Nedd some kind of "before_create" to achieve this?

enter image description here

Luccas
  • 4,078
  • 6
  • 42
  • 72

1 Answers1

0

You probably want to override sorting via default_sort in your model.

This question covers how to do a natural sort in Ruby.

Community
  • 1
  • 1
Nate
  • 16,748
  • 5
  • 45
  • 59