Permalink
Browse files

Use findable.reorder() to override the default_scope order

Otherwise the 'by' and 'order' attributes in <r:children:each> and other tags that use render_children_with_pagination are appended to the order option i.o. overwriting it.
  • Loading branch information...
1 parent 708af18 commit 4224df82c6c17795c99d30bce5cbb53591c17d4f @jomz jomz committed Feb 18, 2014
Showing with 2 additions and 1 deletion.
  1. +2 −1 app/models/standard_tags.rb
@@ -1151,7 +1151,8 @@ def render_children_with_pagination(tag, opts={})
paging = pagination_find_options(tag)
result = []
tag.locals.previous_headers = {}
- displayed_children = paging ? findable.paginate(options.merge(paging)) : findable.all(options)
+ order = options.delete(:order)
+ displayed_children = paging ? findable.paginate(options.merge(paging)).reorder(order) : findable.reorder(order).all(options)
displayed_children.each_with_index do |item, i|
tag.locals.child = item
tag.locals.page = item

0 comments on commit 4224df8

Please sign in to comment.