0
0
Fork 0

extend regex for catching files

This commit is contained in:
Gibheer 2013-10-27 13:09:44 +01:00
parent d8fe8a97bc
commit 1e26faa84a
1 changed files with 2 additions and 1 deletions

View File

@ -1,8 +1,9 @@
class Router
ROUTE_REGEX = %r{\A(/(?<controller>[a-zA-Z]+)(/(?<id>[^/]+)?)?)?\Z}
ROUTE_REGEX = %r{\A(/(?<controller>[a-zA-Z]+)\.?(?<extension>[a-zA-Z]+)?(/(?<id>[^/]+)?)?)?\Z}
# get the controller handling the request
def self.call(session)
variables = session.request.path.match(ROUTE_REGEX)
puts variables.inspect
return default_route unless variables && variables[:controller]
session.options[:id] = variables[:id]
find variables[:controller]