Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:evanmiller/ChicagoBoss

  • Loading branch information...
commit 414423c1d694c5219d7c1ba994b2df9f9a3656e6 2 parents 74208cb + 868aa32
@evanmiller evanmiller authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/boss/boss_router_controller.erl
View
8 src/boss/boss_router_controller.erl
@@ -8,7 +8,7 @@
-define(BOSS_ROUTES_TABLE, boss_routes).
-define(BOSS_HANDLERS_TABLE, boss_handlers).
--record(boss_route, {url, pattern, application, controller, action, params = []}).
+-record(boss_route, {number, url, pattern, application, controller, action, params = []}).
-record(boss_handler, {status_code, application, controller, action, params = []}).
-record(state, {
@@ -137,9 +137,10 @@ load(State) ->
RoutesFile = boss_files:routes_file(State#state.application),
error_logger:info_msg("Loading routes from ~p ....~n", [RoutesFile]),
case file:consult(RoutesFile) of
- {ok, Routes} ->
+ {ok, OrderedRoutes} ->
+ Routes = lists:zipwith(fun(Number, {Url, Proplist}) -> {Number, Url, Proplist} end, lists:seq(1,length(OrderedRoutes)), OrderedRoutes),
lists:map(fun
- ({UrlOrStatusCode, Proplist}) when is_list(Proplist) ->
+ ({Number, UrlOrStatusCode, Proplist}) when is_list(Proplist) ->
TheApplication = proplists:get_value(application, Proplist, State#state.application),
TheController = proplists:get_value(controller, Proplist),
TheAction = proplists:get_value(action, Proplist),
@@ -150,6 +151,7 @@ load(State) ->
Url when is_list(Url) ->
{ok, MP} = re:compile("^"++Url++"$"),
NewRoute = #boss_route{
+ number = Number,
url = Url,
pattern = MP,
application = TheApplication,

0 comments on commit 414423c

Please sign in to comment.
Something went wrong with that request. Please try again.