Commit 224c0103 authored by James Edwards-Jones's avatar James Edwards-Jones

Refactor RoutableActions to allow for additional checks

parent 0f6500d5
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment