lib/rho/rhocontroller.rb in rhodes-framework-1.1.1 vs lib/rho/rhocontroller.rb in rhodes-framework-1.2.0
- old
+ new
@@ -2,21 +2,25 @@
require 'rho/rhosupport'
require 'rho/rhoviewhelpers'
module Rho
class RhoController
+ attr_accessor :menu
def default_action
return Hash['GET','show','PUT','update','POST','update',
'DELETE','delete'][@request['request-method']] unless @request['id'].nil?
return Hash['GET','index','POST','create'][@request['request-method']]
end
- def serve(object_mapping,req,res)
- @request, @response = req, res;
+ def serve(application,object_mapping,req,res)
+ @request, @response = req, res
@object_mapping = object_mapping
@params = RhoSupport::query_params req
- send req['action'].nil? ? default_action : req['action']
+ res = send req['action'].nil? ? default_action : req['action']
+ application.set_menu(@menu)
+ @menu = nil
+ res
end
# Returns true if the request's header contains "XMLHttpRequest".
def xml_http_request?
not /XMLHttpRequest/i.match(@request['headers']['X-Requested-With']).nil?
\ No newline at end of file