I would use scopes just because it nicely encapsulates the search functionality into the class to which it belongs so you can reuse it elsewhere.
class Post < ActiveRecord::Base
scope :descending, ->() { order(arel_table[:created_at].desc) }
end
class Topic < ActiveRecord::Base
# reuse the descending scope from the Post class to define an
# order on the Topic class
scope :descending, ->() {
joins(:posts).merge( Post.descending )
}
end
Then you can do:
@topics = Topic.descending
If you also want to include the posts in the query you can still do:
@topics = Topic.descending.includes(:posts)