Handle case where no params are sent because nothing is checked
This commit is contained in:
@@ -4,12 +4,19 @@ module DayTimelinesScoped
|
||||
included do
|
||||
include FilterScoped
|
||||
|
||||
before_action :normalize_collection_params
|
||||
before_action :restore_collections_filter_from_cookie
|
||||
before_action :set_day_timeline
|
||||
after_action :save_collections_filter_to_cookie
|
||||
end
|
||||
|
||||
private
|
||||
def normalize_collection_params
|
||||
if params[:collection_ids].blank? && !params[:clear_filter]
|
||||
params[:collection_ids] = []
|
||||
end
|
||||
end
|
||||
|
||||
def restore_collections_filter_from_cookie
|
||||
if params[:clear_filter]
|
||||
delete_collections_filter_cookie
|
||||
|
||||
Reference in New Issue
Block a user