As stated in: http://filterrific.clearcove.ca/pages/action_controller_api.html, filterrific by default persists filters params:
# * Options:
# * persistence_id: optional, defaults to "<controller>#<action>" string
# to isolate session persistence of multiple filterrific instances.
# Override this to share session persisted filter params between
# multiple filterrific instances. Set to `false` to disable session
# persistence.
So in actions other than index we could get the filtered records initializing filterrific with the session stored values:
def get_filtered_participations
@filterrific = initialize_filterrific(
@event.participations,
session["participations#index"],
select_options: {
yes_no: [["Sì", true], ["No", false]],
with_category_ids: Category.options_for_select,
with_shipping_type_ids: ShippingType.options_for_select,
with_event_ids: Event.options_for_select
}
) or return
@participations = @filterrific.find
# Recover from invalid param sets, e.g., when a filter refers to the
# database id of a record that doesn't exist any more.
# In this case we reset filterrific and discard all filter params.
rescue ActiveRecord::RecordNotFound => e
# There is an issue with the persisted param_set. Reset it.
puts "Had to reset filterrific params: #{e.message}"
redirect_to(reset_filterrific_url(format: :html)) and return
end