The typical usage is to describe all the possible collection manipulation for REST index
action, e.g. filtering, sorting, searching, pagination, etc..
So, instead of:
class CourseSessionController < ApplicationController
def index
@sessions = CourseSession
.search(params[:q])
.by_course_type(params[:course_type_id])
.by_role(params[:role_id])
.paginate(page_params)
.order(ordering_params)
end
end
You have:
class CourseSessionController < ApplicationController
def index
@sessions = rubanok_process(
# pass input
CourseSession.all,
# pass params
params,
# provide a processor to use
with: CourseSessionsProcessor
)
end
end
Or we can try to infer all the configuration for you:
class CourseSessionController < ApplicationController
def index
@sessions = rubanok_process(CourseSession.all)
end
end