Description
Sorts subjects using sorting params
Tip
Override this method to change sorting of subjects
Used in
Use
Example
class BooksController < ApplicationController
include RestingPug::Base
private
# Override a sort_subjects method to remove default ordering beforehand.
def sort_subjects
@subjects = @subjects.reorder(nil).order(sort_params)
end
end
Source code
# lib/resting_pug/modificators.rb
def sort_subjects
@subjects = @subjects.order(sort_params)
end