Hello All,
I need to perform natural sorting on alphanumeric column’s data and even return type should be ActiveRecord::Relation. I tried ‘naturally’ and ‘‘naturalsorter’’ gem but not successful.Below link explain what is natural sorting.
Thanks! in advance
Found the solution. Change the ‘col_name’ with your table alphanumeric column name.
MyModel.order(“LENGTH(col_name)”).order(:col_name)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.