From 0c27ede5eaa089293b1a6cdb7a3ff9949a7b4a10 Mon Sep 17 00:00:00 2001 From: Jose Farias Date: Thu, 17 Oct 2024 20:53:07 -0600 Subject: [PATCH] Clean up #set_view --- app/controllers/bubbles_controller.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/bubbles_controller.rb b/app/controllers/bubbles_controller.rb index 5252d1a4c..034e5e8cf 100644 --- a/app/controllers/bubbles_controller.rb +++ b/app/controllers/bubbles_controller.rb @@ -48,14 +48,9 @@ class BubblesController < ApplicationController end def set_view - if params[:view_id] - @view = @bucket.views.find_by_id params[:view_id] - end - - unless @view - @view = @bucket.views.find_by creator: Current.user, filters: helpers.bubble_filter_params.to_h - params[:view_id] = @view&.id - end + @view = @bucket.views.find_by_id(params[:view_id]) if params[:view_id] + @view ||= @bucket.views.find_by(creator: Current.user, filters: helpers.bubble_filter_params.to_h) + params[:view_id] = @view.id end def set_tag_filters