Add filter by goal

This commit is contained in:
Javi Martín
2020-12-17 19:13:48 +01:00
parent 791ba73e12
commit c9362ffeb4
10 changed files with 101 additions and 14 deletions

View File

@@ -3,7 +3,11 @@ class SDGManagement::RelationsController < SDGManagement::BaseController
before_action :load_record, only: [:edit, :update]
def index
@records = relatable_class.accessible_by(current_ability).order(:id).page(params[:page])
@records = relatable_class
.accessible_by(current_ability)
.by_goal(params[:goal_code])
.order(:id)
.page(params[:page])
@records = @records.search(params[:search]) if params[:search].present?
end