Class: Spina::Resource

Inherits:
ApplicationRecord show all
Defined in:
app/models/spina/resource.rb

Instance Method Summary collapse

Instance Method Details

#pagesObject



9
10
11
12
13
14
15
16
# File 'app/models/spina/resource.rb', line 9

def pages
  case order_by
  when "title"
    super.joins(:translations).where(spina_page_translations: {locale: I18n.locale}).order("spina_page_translations.title")
  else
    super.order(created_at: :desc)
  end
end