diff options
Diffstat (limited to 'app/models/page.rb')
| -rw-r--r-- | app/models/page.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/page.rb b/app/models/page.rb index a66527da..8313b1d4 100644 --- a/app/models/page.rb +++ b/app/models/page.rb | |||
| @@ -92,6 +92,11 @@ class Page < ApplicationRecord | |||
| 92 | .paginate(:page => page, :per_page => options[:limit]) | 92 | .paginate(:page => page, :per_page => options[:limit]) |
| 93 | end | 93 | end |
| 94 | 94 | ||
| 95 | if options[:order_by] == "slug" | ||
| 96 | return scope.order(Arel.sql("MIN(LOWER(nodes.slug)) #{direction}")) | ||
| 97 | .paginate(:page => page, :per_page => options[:limit]) | ||
| 98 | end | ||
| 99 | |||
| 95 | column = options[:order_by].to_s.sub(/\Apages\./, "") | 100 | column = options[:order_by].to_s.sub(/\Apages\./, "") |
| 96 | column = "id" unless %w[id published_at created_at updated_at].include?(column) | 101 | column = "id" unless %w[id published_at created_at updated_at].include?(column) |
| 97 | 102 | ||
