Skip to content

Commit

Permalink
fix: add year to referrer url in budget view
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoSimon committed Mar 10, 2024
1 parent bc95739 commit 8fee466
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/movements_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def movement_params
end

def redirect_destination
return budget_url(@account.budget, date: {month: selected_month}) if selected_month
return budget_url(@account.budget, date: {month: selected_month, year: selected_year}) if selected_month
account_url(@movement.account)
end

Expand All @@ -58,6 +58,12 @@ def selected_month
DateTime.strptime(params[:movement][:date], "%F").month
end

def selected_year
return nil if params.dig(:movement, :date).nil?

DateTime.strptime(params[:movement][:date], "%F").year
end

def set_movement
@movement = Movement.find(params[:id])
end
Expand Down

0 comments on commit 8fee466

Please sign in to comment.