2
I need to alphabetize my category:
@posts_categories = Admin::PostCategory.all
2
I need to alphabetize my category:
@posts_categories = Admin::PostCategory.all
1
The ordination can be done this way:
@posts_categories = Admin::PostCategory.order(name: :asc)
This is if the poss_categories table has the "name" field. If not, simply replace it with the field name to be used as the sort criteria.
The asc
says that the ordering will be done in ascending form (A-Z or 0 - 10...)
To learn more about the subject, visit: http://guides.rubyonrails.org/active_record_querying.html#ordering
Thanks... it worked out
@Michellysabatiny don’t forget to take a look at the link I left there
You can leave...! I’m going to see now
Browser other questions tagged ruby controller
You are not signed in. Login or sign up in order to post.
the sort should be done on the basis of which field?
– WeezHard
categories have to put my category in alphabetical order
– Michelly Sabatiny
but this category has a field that will serve as a criterion to sort. what is this field?
– WeezHard