Reuse filter scope

This commit is contained in:
Jorge Manrubia
2025-06-12 12:39:33 +02:00
parent 5364585818
commit a979daddf3
2 changed files with 3 additions and 6 deletions
+2 -5
View File
@@ -1,5 +1,6 @@
class Cards::DropsController < ApplicationController
before_action :set_filter, :set_card, :set_drop_target
include FilterScoped
before_action :set_card, :set_drop_target
def create
perform_drop_action
@@ -9,10 +10,6 @@ class Cards::DropsController < ApplicationController
private
VALID_DROP_TARGETS = %w[ considering doing ]
def set_filter
@filter = Current.user.filters.from_params params.reverse_merge(**FilterScoped::DEFAULT_PARAMS).permit(*Filter::PERMITTED_PARAMS)
end
def set_card
@card = Current.user.accessible_cards.find(params[:dropped_item_id])
end
+1 -1
View File
@@ -2,7 +2,7 @@ module FilterScoped
extend ActiveSupport::Concern
included do
before_action :set_filter, only: :index
before_action :set_filter
end
private