mirror of
https://github.com/we-promise/sure.git
synced 2026-05-29 23:39:03 +00:00
perf+ux(goals): grouped state-count + friendly 404 for stale/cross-family deep links
- index: STATE_FILTERS count loop replaced with single Current.family.goals.group(:state).count + per-state lookup. 5 SQL queries -> 1. - GoalsController + GoalContributionsController: rescue_from ActiveRecord::RecordNotFound -> redirect_to goals_path with a flash. Affects stale deep links AND cross-family access (previously bare 404 -> Chrome error page). Test for cross-family access updated to assert the redirect + flash key. - New locale key goals.errors.not_found.
This commit is contained in:
@@ -141,6 +141,7 @@ class GoalsControllerTest < ActionDispatch::IntegrationTest
|
||||
other_goal.save!
|
||||
|
||||
get goal_url(other_goal)
|
||||
assert_response :not_found
|
||||
assert_redirected_to goals_path
|
||||
assert_equal I18n.t("goals.errors.not_found"), flash[:alert]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user