lib/spire/router.rb in spire-0.1.10 vs lib/spire/router.rb in spire-0.2.0
- old
+ new
@@ -11,10 +11,12 @@
@request[:controller] = req[1]
@request[:action] = req[2]
end
def route
+ @controller_value = nil
+ @action_value = nil
if @request[:controller] == nil
route = @routes['default'].split("#")
@controller_value = route[0].capitalize
if @request[:action] == nil
@action_value = "index"
@@ -34,11 +36,12 @@
end
end
end
unless @controller_value
return Response.new('404 - Page or route not found!')
+ else
+ return self.run
end
- return self.run
end
def run
require "#{@base_path}/controllers/#{@controller_value}Controller"
@app = Kernel.const_get(@controller_value).new(@base_path)
\ No newline at end of file