Module: PagesCore::PageModel::Sortable::ClassMethods
- Defined in:
- app/models/concerns/pages_core/page_model/sortable.rb
Instance Method Summary collapse
Instance Method Details
#order_by_tags(tags) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/concerns/pages_core/page_model/sortable.rb', line 14 def () joins( "LEFT JOIN taggings ON taggings.taggable_id = pages.id AND " \ "taggings.tag_id IN (#{.map(&:id).join(',')}) AND " \ "taggings.taggable_type = " \ "#{ActiveRecord::Base.connection.quote('Page')}" ) .group("pages.id, localizations.id") .reorder(Arel.sql("COUNT(taggings.id) DESC")) end |