diff options
-rw-r--r-- | app/controllers/concerns/routable_actions.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/controllers/concerns/routable_actions.rb b/app/controllers/concerns/routable_actions.rb index 5624eb3aa45..236f095ae31 100644 --- a/app/controllers/concerns/routable_actions.rb +++ b/app/controllers/concerns/routable_actions.rb @@ -9,9 +9,7 @@ module RoutableActions ensure_canonical_path(routable, requested_full_path) routable else - if not_found_or_authorized_proc - not_found_or_authorized_proc.call(routable) - end + perform_not_found_actions(routable, [not_found_or_authorized_proc]) route_not_found unless performed? @@ -19,6 +17,14 @@ module RoutableActions end end + def perform_not_found_actions(routable, actions) + actions.compact.each do |action| + break if performed? + + action.call(routable) + end + end + def routable_authorized?(routable, extra_authorization_proc) return false unless routable |