From e7faa24f020305e56264aec68c3c6b196179dd4a Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Fri, 18 Jul 2025 05:26:17 -0400 Subject: [PATCH] Fix tab param initialization --- app/components/UI/account_page.rb | 2 +- app/controllers/accounts_controller.rb | 1 + app/views/accounts/show.html.erb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/components/UI/account_page.rb b/app/components/UI/account_page.rb index 012f9240..159ed56f 100644 --- a/app/components/UI/account_page.rb +++ b/app/components/UI/account_page.rb @@ -19,7 +19,7 @@ class UI::AccountPage < ApplicationComponent end def active_tab - tabs.find { |tab| tab == @active_tab } || tabs.first + tabs.find { |tab| tab == @active_tab&.to_sym } || tabs.first end def tabs diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 16f9e853..7bf4470c 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -11,6 +11,7 @@ class AccountsController < ApplicationController def show @chart_view = params[:chart_view] || "balance" + @tab = params[:tab] @q = params.fetch(:q, {}).permit(:search) entries = @account.entries.search(@q).reverse_chronological diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb index f9255f85..a24e8b0b 100644 --- a/app/views/accounts/show.html.erb +++ b/app/views/accounts/show.html.erb @@ -2,5 +2,5 @@ account: @account, chart_view: @chart_view, chart_period: @period, - active_tab: @active_tab + active_tab: @tab ) %>