Class: Spina::Resource
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Spina::Resource
- Extended by:
- Mobility
- Defined in:
- app/models/spina/resource.rb
Instance Method Summary collapse
Methods inherited from ApplicationRecord
Instance Method Details
#order_by_options ⇒ Object
28 29 30 31 32 33 |
# File 'app/models/spina/resource.rb', line 28 def [ [Spina::Page.human_attribute_name(:title), "title"], [Spina::Page.human_attribute_name(:created_at), "created_at"] ] end |
#pages ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/spina/resource.rb', line 11 def pages case order_by when "title" super.joins(:translations).where(spina_page_translations: {locale: I18n.locale}).order("spina_page_translations.title") when "created_at" super.order(:created_at) else super.order(:position) end end |
#update_resource_pages ⇒ Object
22 23 24 25 26 |
# File 'app/models/spina/resource.rb', line 22 def update_resource_pages if previous_changes[:slug] ResourcePagesUpdateJob.perform_later(id) end end |